试试吧:
Dim xls as object
dim rst as recordset
set rst=Me![chd查询结果].Form.recordset.clone
Set xls = CreateObject("Excel.application")
With xls
.Workbooks.Add
.Range("A1").copyfromrecordset rst
End With
xls.Selection.Columns.AutoFit
xls.Selection.Rows.AutoFit
xls.Selection.Interior.ColorIndex = -4142 'xlNone
'-------------------------------------------格式化电子表格 END-----------------------------------------------
'释放对象变量
xls.ActiveSheet.SaveAs FileName:="" & FileName
xls.Visible = True
Set xls = Nothing
[此贴子已经被作者于2004-12-14 15:27:20编辑过]
|