ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Issue (https://www.excelbanter.com/excel-programming/376327-macro-issue.html)

TimWal

Macro Issue
 
Hey guys,

I am having an issue with a macro from Excel 2002 in Excel 2003. Under
2002 it works just fine, but errors out in 2003.

Can anyone tell what is wrong with it, any help would be greatly
appreciated -

Sub Save_to_History()

Dim BackupFileName As String

BackupFileName = Range("openfile")

If MsgBox("Are you sure you want to save to history?", vbYesNo +
vbCritical, "WARNING!") = vbYes Then

ActiveWorkbook.Save
ActiveWorkbook.SaveCopyAs ("C:\data\forms\history\" & Range("o3"))

End If


End Sub


Jim Cone

Macro Issue
 
What is the error and at what line does it occur?
Possibilities...

Splitting a line in a msgbox at the "+" sign can result in Excel
dropping the "+".

Since you have a new version of Excel, does that mean you are
using a different computer? If so the file path may not exist.

Is there already an existing file with the name you are trying to use?

Is there a named range called "openfile". How is it used in the sub?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"TimWal"
wrote in message
Hey guys,
I am having an issue with a macro from Excel 2002 in Excel 2003. Under
2002 it works just fine, but errors out in 2003.
Can anyone tell what is wrong with it, any help would be greatly
appreciated -

Sub Save_to_History()

Dim BackupFileName As String

BackupFileName = Range("openfile")

If MsgBox("Are you sure you want to save to history?", vbYesNo +
vbCritical, "WARNING!") = vbYes Then
ActiveWorkbook.Save
ActiveWorkbook.SaveCopyAs ("C:\data\forms\history\" & Range("o3"))
End If
End Sub


All times are GMT +1. The time now is 11:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com