I got the following VBA code, just want to know how to know the file in the GETOBJECT existed! MY idea is to know 1) if the file existed then do the Marco inside the file and 2) if it is not existed then put the file name in a table?? RIght now, when the VBA encountered this GETOBJECT statement, if file not existed, then error message appeared! I have used on error go to , and on error resume , but it is still come up a system error message, telling error 432 of which file not existed!! Please help, thanks a lot!!
Dim appXL As New Excel.Application
Dim appXlBook As Excel.Workbook
Dim appXLQuerySheet As Excel.Worksheet
Dim pathname As String
Dim transfile As String
Dim extension As String
Dim fullpath As String
:
:
:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "DATAExport", "D:\common\invoice\DATAExport.xls", False
If (Forms![tempmasterinput]![Text501] = -1) Then
Set appXlBook = GetObject("C:\COMMON\PRINTTRANS NEW SUM B1.xls")
Else
Set appXlBook = GetObject("C:\COMMON\PRINTTRANS NEW SUM.xls")
End If
:
:
Dim appXL As New Excel.Application
Dim appXlBook As Excel.Workbook
Dim appXLQuerySheet As Excel.Worksheet
Dim pathname As String
Dim transfile As String
Dim extension As String
Dim fullpath As String
:
:
:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "DATAExport", "D:\common\invoice\DATAExport.xls", False
If (Forms![tempmasterinput]![Text501] = -1) Then
Set appXlBook = GetObject("C:\COMMON\PRINTTRANS NEW SUM B1.xls")
Else
Set appXlBook = GetObject("C:\COMMON\PRINTTRANS NEW SUM.xls")
End If
:
: