在下寫了一小段VBA將查詢表單轉至excel
但出現2個異常:
1.模組的"執行"按鈕是灰色的沒法按
2.至設計模式下執行時,會出現錯誤:
jet資料庫引擎無法找到物件
另一個下載位置:
https://rapidshare.com/files/1241167939/emp.mdb
https://rapidshare.com/files/1714369419/員工.xls
請在中間下方
Save File to...
...your computer.
按底下的綠色"DOWNLOAD"鍵即可下載
Function 轉出資料到excel()
On Error GoTo 轉出資料到excel_Err
Dim strPassword As String
Dim strFilePath As String
strPassword = ""
strFilePath = "D:\aaaa.xls"
If (MsgBox("確定要轉到excel應收帳款嗎?", 1) = 1) Then
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "員工查詢", strFilePath, True, ""
DoCmd.TransferSpreadsheet acExport, 8, "查詢員工", strFilePath, True, ""
Beep
MsgBox "轉excel成功!", vbInformation, ""
Else
Beep
MsgBox "轉excel失敗!", vbInformation, ""
End If
轉出資料到excel_Exit:
Exit Function
轉出資料到excel_Err:
MsgBox Error$
Resume 轉出資料到excel_Exit
End Function