Hi,
I have written a macro to save a file in 3 different locations (one being an HTM file as well). I have several schedule files (created by doing File Save As from an original) that this macro will be applied to. I have inserted the macro into each file and created a Macro Menu item which has been mapped to the "This Workbook" macro item that i have written. (End Background, Begin Problem/Question) When I run this macro from one sheet, close that workbook, open a different workbook and run the macro, my macro looks for the previous file name. I am not "quite" sure if the problem is code related or tied to the menu assignment. I have included the code for reference and hope someone may have a better way of doing this.
Code:
Sub SaveHTML()
Dim conNetPath As String
Dim conHomePath As String
Dim conBUPath As String
Dim fName As String
Dim HTMLFile As String
conNetPath = "\\atlnewsf04\Sudhir Keep\Stuff\skeds\"
conBUPath = "c:\Schedules\"
conHomePath = ActiveWorkbook.FullName
fName = ActiveWorkbook.Name
HTMLFile = Replace(fName, "xls", "htm")
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
conNetPath & HTMLFile, FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:= _
conBUPath & fName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
'MsgBox conHomePath
ActiveWorkbook.SaveAs Filename:= _
conHomePath, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
End Sub
When you call this macro from the first file, it works fine. If you close that file and open another file with the same macro and try to run it, it looks for the previously opened file.
Not sure where I goofed but this is in the Modules section for each spreadsheet
Thanks
Scott Medaugh