PDA

View Full Version : [SOLVED:] Save problem



Airborne
10-28-2004, 03:41 AM
:confused: I know I have still one thread open but to get my mind of things I looked into another problem.
I got this routine from the forum a while ago


Sub Save()
Dim fName As String
fName = Workbooks("Report1").Sheets("Data").[A85]
Workbooks(fName).Activate
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios _
:=True, Password:="apex"
ActiveWorkbook.Save
Application.DisplayAlerts = False
ActiveWindow.Close
End Sub

From the workbook Report1 I opened a workbook called 28-10-2004_1.xls. After changing the value of a cell in the opened workbook, I select workbook Report1 again activate the macro Save and then get the error message "subscript out of range"? But the value in cell A85 is the exact name of the file I see sitting in the taskbar. When I look at the value that is highlighted (because of the error), I see the correct name. Still the workbook 28-10-2004_1.xls is not activated???:dunno


Sorry, dumb:blush . I forgot to let the import routine write to the cell (A85). The value I saw in the cell was there already and was not put there by the routine.

Sorry.

Zack Barresse
10-28-2004, 09:15 AM
Wow, question and answer all in one post! Most inpressive! :D

Seriously, good job. Most people will not even attempt to test/prod their code once they post a question, let alone do research before they post. :)