Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
geb geb is offline
external usenet poster
 
Posts: 19
Default 'On Error' question

I have a macro that imports external data specifying a file name, location.

With ActiveSheet.QueryTables.Add(Connection.....
......End With

If that file is not there I would want a message box.
I have tried 'On Error' but it behaved the same with
or without the file present.
Where do I need to do the display a message if the file is missing
and not display a message if the file is found?


(Same question asked yesterday after I tried the 'On Error')
  #2   Report Post  
Posted to microsoft.public.excel.programming
bac bac is offline
external usenet poster
 
Posts: 76
Default 'On Error' question

try:

If <file path\name then 'Will be TRUE if file exists, FALSE if not

import file

else
do msg box

end if

"GEB" wrote:

I have a macro that imports external data specifying a file name, location.

With ActiveSheet.QueryTables.Add(Connection.....
.....End With

If that file is not there I would want a message box.
I have tried 'On Error' but it behaved the same with
or without the file present.
Where do I need to do the display a message if the file is missing
and not display a message if the file is found?


(Same question asked yesterday after I tried the 'On Error')

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
#VALUE ERROR Question Brent Excel Discussion (Misc queries) 1 May 13th 10 12:32 AM
Standard Error Question Barb Reinhardt Excel Worksheet Functions 0 March 20th 08 11:43 PM
Error msg question April Excel Discussion (Misc queries) 4 October 14th 06 08:37 PM
#Ref error question TimN Excel Worksheet Functions 2 July 31st 06 02:31 PM
Drillthrough MDX ERROR(Error.Number:-21467259) ?(urgent question) Microlong Excel Programming 2 March 4th 05 01:55 AM


All times are GMT +1. The time now is 08:29 AM.

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

About Us

"It's about Microsoft Excel"