SaveAs help  
Author Message

PostPosted: Visual Basic for Applications (VBA), SaveAs help Top

I am trying to write a macro that saves a file with the name of a person. The name of the person is always in the same cell location, Column A. I am currently using this line to do the save:

ActiveWorkbook.SaveAs Filename:="O:\Lead Report\temp\" & Sheet.Range("A2") & ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

I get the error: "Runtime error (424) - Object Required"

I do not know what this means.

The Workbook I am trying to save is generated from a drill down into a Pivot table that is then Moved to the new workbook.

Any suggestions would be appreciated.


Microsoft ISV Community Center Forums2  

PostPosted: Visual Basic for Applications (VBA), SaveAs help Top

Hi John

Replace sheet.range("A2") with ActiveSheet.Range("A2"). If the cell is not on the active sheet you need to use the correct worksheet reference eg Worksheets("Sheet1").Range("A2")