使用sql语句输出access表至Excel文件,如:
'select * into [Excel 8.0;database=" & FileName & "].List from 表1"
如何用最简单的方法为这个Excel文件增加头信息,如:xx.xls
头文字信息1 信息2表1各字段内容
表1各字段内容
表1各字段内容
表1各字段内容
'select * into [Excel 8.0;database=" & FileName & "].List from 表1"
如何用最简单的方法为这个Excel文件增加头信息,如:xx.xls
头文字信息1 信息2表1各字段内容
表1各字段内容
表1各字段内容
表1各字段内容
dim Cn as new adodb.connection
dim Rs as new adodb.recordset With Rs
If .State = adStateOpen Then .Close
.ActiveConnection = Cn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Source = Str
.Open
End With
'对记录进行快速添加到excel 中去
If Rs.RecordCount = 0 Then
MsgBox "没有记录", 48, "平衡力量管理信息系统"
Exit Sub
Else
row = Rs.RecordCount
Col = Rs.Fields.Count End If
'-------------
Me.MousePointer = 11
' probar.Min = 0
' probar.Max = Rs.RecordCount
'---------------添加数据
Set ExcelQuery = ExcelWS.QueryTables.Add(Rs, ExcelWS.Range("a1"))
With ExcelQuery
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
End With
ExcelQuery.Refresh
hdr = yes
是什么意思啊?
想知道是什么意思?