Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default If Worbook Name = "X" then Prevent Macro From Running

Hi, I have a few macros that need to be run, but only after the user saves
the file as a different name.

Any suggestions that would to add a VBA snippet to a macro that would
prevent it to run if the current workbook name is "X"?

If not too much additional trouble, could I add a pop-up box that states
"Save File as Different Name Before Running Macro." ?

Thanks very much... SteveC
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default If Worbook Name = "X" then Prevent Macro From Running

Hi Steve

Try this

Sub test()
If ThisWorkbook.Name < "X" Then
' your code
Else
MsgBox "Save File as Different Name Before Running Macro"
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"SteveC" wrote in message ...
Hi, I have a few macros that need to be run, but only after the user saves
the file as a different name.

Any suggestions that would to add a VBA snippet to a macro that would
prevent it to run if the current workbook name is "X"?

If not too much additional trouble, could I add a pop-up box that states
"Save File as Different Name Before Running Macro." ?

Thanks very much... SteveC



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default If Worbook Name = "X" then Prevent Macro From Running

Many thanks Ron. (Many of these macros already include snippets of code you
have posted. )


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
In Excel 2003 is there a way to prevent "Save As" and "Print"? lucky2000 Excel Discussion (Misc queries) 3 April 26th 07 02:49 PM
Sheets("Rpt").Copy different results from running in macro than off excel menu?? tmbo Excel Discussion (Misc queries) 7 August 9th 06 01:13 PM
Prevent code in "Sheet Activate" from running when sheet made visible from other macr Simon Lloyd[_794_] Excel Programming 10 June 21st 06 09:15 AM
prevent recalculation of random data except in a "Calculate" macro matt dunbar Excel Programming 1 December 10th 03 01:02 PM
"Programmatic Access to be Denied" displays when running macro on excel in XP Stephen Fong Excel Programming 3 October 21st 03 09:19 AM


All times are GMT +1. The time now is 05:45 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"