A
Activoz_Interpreting
Let me begin by saying I'm not a programmer (any more), I'm a Spanish
interpreter at a Court. I have done all of the following using the "macro
record" and "customize toolbar" features from the Excel menus - I do not do
any VB programming.
I have created an Excel 2003 spreadsheet, running in Windows XP, that
contains a simple macro, stored in the workbook itself, to do some find and
replace commands. Let's call the worksheet "Master_file.xls". Let's call the
macro "My_macro" The macro is in the spreadsheet.
I created a custom toolbar (let's call it "smiley_face"), attached to this
spreadsheet, and assigned the macro to the toolbar. The name of the assigned
macro appears as My_macro. It does not indicate any excel file name.
I made the spreadsheet read-only - I want to be sure my end-users at other
Courts can’t mess it up.
Here’s the problem:
My users paste data into the spreadsheet, press the smiley face button,
(which runs My_macro) and then "save as". It's read-only so they rename it as
"Saved_File".
The next time my user opens "Master_File", pastes data, and then presses the
"smiley face" button to run the macro, Excel opens "Saved_File" to get the
macro.
The name of the macro assigned to the toolbar now says 'Saved_File'!My_macro
When the user tries to do a save as "Saved_File", excel says it can't save,
since that file is already open (since it opened it to get the macro). They
have to close “Saved_File†first, then "save as" again, and they are confused
about what happened. Sometimes they wind up not saving anything.
I’m perplexed about why the macro address pointer assigned to the toolbar
changes to the file name last saved. I tried hard-coding the name into the
original worksheet, but that doesn’t seem to make any difference. I would
like the macro to always run from “Master_Fileâ€, rather than from the file
last saved. Can I do this without coding, or by just editing the existing
macro code in the VB editor? Or what are my options?
Here’s the macro code:
Sub Replace_Chars()
'
' Replace_Chars Macro
' Macro recorded 8/31/2007 by Maintenance
'
Cells.Replace What:="@", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="~*F-", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End Sub
Thanks a lot!
Activoz_Interpreting
interpreter at a Court. I have done all of the following using the "macro
record" and "customize toolbar" features from the Excel menus - I do not do
any VB programming.
I have created an Excel 2003 spreadsheet, running in Windows XP, that
contains a simple macro, stored in the workbook itself, to do some find and
replace commands. Let's call the worksheet "Master_file.xls". Let's call the
macro "My_macro" The macro is in the spreadsheet.
I created a custom toolbar (let's call it "smiley_face"), attached to this
spreadsheet, and assigned the macro to the toolbar. The name of the assigned
macro appears as My_macro. It does not indicate any excel file name.
I made the spreadsheet read-only - I want to be sure my end-users at other
Courts can’t mess it up.
Here’s the problem:
My users paste data into the spreadsheet, press the smiley face button,
(which runs My_macro) and then "save as". It's read-only so they rename it as
"Saved_File".
The next time my user opens "Master_File", pastes data, and then presses the
"smiley face" button to run the macro, Excel opens "Saved_File" to get the
macro.
The name of the macro assigned to the toolbar now says 'Saved_File'!My_macro
When the user tries to do a save as "Saved_File", excel says it can't save,
since that file is already open (since it opened it to get the macro). They
have to close “Saved_File†first, then "save as" again, and they are confused
about what happened. Sometimes they wind up not saving anything.
I’m perplexed about why the macro address pointer assigned to the toolbar
changes to the file name last saved. I tried hard-coding the name into the
original worksheet, but that doesn’t seem to make any difference. I would
like the macro to always run from “Master_Fileâ€, rather than from the file
last saved. Can I do this without coding, or by just editing the existing
macro code in the VB editor? Or what are my options?
Here’s the macro code:
Sub Replace_Chars()
'
' Replace_Chars Macro
' Macro recorded 8/31/2007 by Maintenance
'
Cells.Replace What:="@", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="~*F-", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End Sub
Thanks a lot!
Activoz_Interpreting