LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Macro in WB assigned to toolbar, after "save as" points to differn

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 cant mess it up.

Heres 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.

Im 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 doesnt 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?

Heres 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


 
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
"Save" and "Save As" options greyed out - "Save as Webpage" option Bill Excel Discussion (Misc queries) 0 January 16th 07 04:47 PM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
Running a macro "On Save" heski Excel Discussion (Misc queries) 2 May 18th 06 01:55 PM
Macro to create "path" for save Chris Excel Discussion (Misc queries) 4 March 15th 06 10:38 AM


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

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"