Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.access,microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default 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   Report Post  
Posted to microsoft.public.access,microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. san Excel Programming 1 January 3rd 06 03:22 AM
Open email windows can't open, excel shreadsheet file .xls ? skiz Excel Discussion (Misc queries) 0 October 2nd 05 07:03 PM
How do I stop Excel from closing the open file each time I open a. Welsin Setting up and Configuration of Excel 3 January 8th 05 11:16 PM


All times are GMT +1. The time now is 10:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"