Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.access,microsoft.public.excel.programming
|
|||
|
|||
Open Excel file
I have a sub in Access that sucks data out of excel files based on a
path and filename in each record. If the path or filename are wrong and the Open statement not find the file I get a info message that says "c:\temp\filename.xls" can not be found. Check your spelling and try again." It has an ok button to dismiss it. How can I trap this "error" or result so I can just skip to the next record? It does not come up as an error so I can't handle it that way. Ideally I would like to keep track of which ones it cant find but that should be easy if I can figure out how to intersept the info message. Set xlsApp = CreateObject("Excel.application") Set wb = xlsApp.Workbooks.Open(Path & Filename, , True) |
#2
Posted to microsoft.public.access,microsoft.public.excel.programming
|
|||
|
|||
Open Excel file
If Len(Dir(Path & Filename)) 0 Then
Set xlsApp = CreateObject("Excel.application") Set wb = xlsApp.Workbooks.Open(Path & Filename, , True) Else MsgBox Path & Filename & " does not exist." End If -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Michael" wrote in message ... I have a sub in Access that sucks data out of excel files based on a path and filename in each record. If the path or filename are wrong and the Open statement not find the file I get a info message that says "c:\temp\filename.xls" can not be found. Check your spelling and try again." It has an ok button to dismiss it. How can I trap this "error" or result so I can just skip to the next record? It does not come up as an error so I can't handle it that way. Ideally I would like to keep track of which ones it cant find but that should be easy if I can figure out how to intersept the info message. Set xlsApp = CreateObject("Excel.application") Set wb = xlsApp.Workbooks.Open(Path & Filename, , True) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel 2003 saved file will not open without a blank workbook open | Excel Discussion (Misc queries) | |||
In Excel - Use Windows Explorer instead of File Open to open file | Excel Discussion (Misc queries) | |||
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. | Excel Programming | |||
Open email windows can't open, excel shreadsheet file .xls ? | Excel Discussion (Misc queries) | |||
How do I stop Excel from closing the open file each time I open a. | Setting up and Configuration of Excel |