2003 Macro Issue

  • Thread starter Thread starter TimWal
  • Start date Start date
T

TimWal

Hey guys,

I am wondering if anyone can help me, I have a macro to save a copy of
an excel spreadsheet that works fine in Excel 2002 but in 2003 gives a
debug error.

The macro is as follows -

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


Basically it does not like the BackupFileName line at the moment.

Any help that anyone can give would be greatly appreciated.

Thanks


Tim Wallace
 
What does it mean to not like the line?

Maybe if you specify the worksheet, too:

Backupfilename = worksheets("sheet9999").range("openfile").value

And are you sure that the OpenFile range name exists and is a single cell?

What's in that cell?
 
And are you sure that the OpenFile range name exists and is a single cell?

What's in that cell?
 
How about this macro I usefor my time card, with a little modification
it should work for you.


' This Macro Checks The Month, Date And Year For A Value Other Than 0
' It Then Saves The Workbook By The Name In Cell "F4" And The Week
Ending Date
' In The Current Directory

On Error Resume Next
If Range("t4").Value > 0 _
And Range("u4").Value > 0 _
And Range("v4").Value > 0 _
And Range("f4").Value > " " _
Then


ThisWorkbook.SaveAs ThisWorkbook.Path & "\" & _
ThisWorkbook.Worksheets(1).Range("f4").Value & _
ThisWorkbook.Worksheets(1).Range("t4").Value & _
ThisWorkbook.Worksheets(1).Range("u4").Value & _
ThisWorkbook.Worksheets(1).Range("v4").Value & _
".xls"
MsgBox "Time Card Saved", vbOKOnly + vbExclamation
Else
MsgBox "Date Not Correct, Or Name Not Entered. Time Sheet Not Saved",
_
vbOKOnly + vbExclamation

End If
End Sub

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top