Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default How to get a MsgBox to pop up if I have VBA write a wrong link

I have a macro that writes a formula in the worksheet that links to
another worksheet. So the VBA code looks something like this "='C:
\PROJECTS\[OtherWorkbook]Sheet1'!A1". The macro is working, but if
somehow I define the address wrong, Excel then pops up the Explorer
form asking me to find the "correct" file. Is there an error trapping
code that I can use in my macro to stop the macro BEFORE the Explorer
form comes up, so that I can have my own MsgBox pop up and then end
the macro run?

Many thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default How to get a MsgBox to pop up if I have VBA write a wrong link

On Sep 21, 6:57*pm, jayray wrote:
I have a macro that writes a formula in the worksheet that links to
another worksheet. So the VBA code looks something like this "='C:
\PROJECTS\[OtherWorkbook]Sheet1'!A1". *The macro is working, but if
somehow I define the address wrong, Excel then pops up the Explorer
form asking me to find the "correct" file. Is there an error trapping
code that I can use in my macro to stop the macro BEFORE the Explorer
form comes up, so that I can have my own MsgBox pop up and then end
the macro run?

Many thanks!


As ALWAYS, post YOUR code for comments
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to get a MsgBox to pop up if I have VBA write a wrong link

"jayray" wrote in message
...
I have a macro that writes a formula in the worksheet that links to
another worksheet. So the VBA code looks something like this "='C:
\PROJECTS\[OtherWorkbook]Sheet1'!A1". The macro is working, but if
somehow I define the address wrong, Excel then pops up the Explorer
form asking me to find the "correct" file. Is there an error trapping
code that I can use in my macro to stop the macro BEFORE the Explorer
form comes up, so that I can have my own MsgBox pop up and then end
the macro run?

Many thanks!



Are you familiar with the On Error statement? In the macro editor (VBE)
window, type "on error statement" in the help search bar.

Good luck!

Clif


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
Modify to write results into B2 down instead of msgbox Max Excel Programming 7 January 3rd 09 03:24 AM
MsgBox FOR SELECTING WRONG FORMAT FILE K[_2_] Excel Programming 0 August 6th 08 12:14 PM
My program read the wrong msgbox anamarie30 Excel Programming 3 July 11th 07 05:48 PM
My 3rd Msgbox is popping up in wrong position JMay Excel Programming 4 April 23rd 07 07:56 PM
Wrong text in msgbox Ed[_9_] Excel Programming 0 August 11th 03 03:21 PM


All times are GMT +1. The time now is 04:36 PM.

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"