VBA中怎么调用另存为对话框

2025-06-27 23:02:35
推荐回答(1个)
回答1:

试试:
Dim wb As Workbook
Dim newname As String
Dim FileName As String
FileName = Application.GetSaveAsFilename("新生成的表.xlsx")
If FileName = "False" Then Exit Sub
Set wb = Workbooks.Add
Dim sqlStr As String
sqlString = "select * into[8.0.Database=wb.sheet1 from accessfile;"
MsgBox sqlStr
DoCmd.RunSQL sqlStr
ActiveWorkbook.SaveAs FileName
Beep