Change text in a macro with another macro

jjpkraft

New Member
Joined
Feb 26, 2002
Messages
32
I have a excel template that won't open unless the file "Commercial Menu.xls" is open.

Code:
On Error GoTo MenuNotOpenError 
Workbooks("Commercial Menu.xls").Activate 
Workbooks(ChecklistWorkbookName).Activate 

MenuNotOpenError: 
    Select Case Err 
        Case 9 
            MsgBox prompt:="Commercial UW Menu must be open." 
        Case Else 
        End Select 
    Workbooks(ChecklistWorkbookName).Activate 
    ActiveWorkbook.Close SaveChanges:=False 
    Exit Sub

The problem is I had to change the file that needs to be open from "Commercial Menu.xls" to "UW Menu.xls". I've corrected the code so new files using the template open as long as "UW Menu.xls" is open but old files won't open since "Commercial Menu.xls" no longer exists.

Is there a way to open all the workbooks in a folder (one at a time) and replace all occurences of "Commercial" with "UW" in the code?

This one has me stumped.

Jason
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,224,889
Messages
6,181,611
Members
453,057
Latest member
LE102024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top