Ben Conner
asked on
working with excel .saveas filename
Hi,
I have the fully qualified filename stored in a string called fname. When I execute the VBA code:
For Each sh In ActiveWorkbook.Worksheets
If sh.Name = "Claims_Detail" Then
sh.Copy
Call formatit
MsgBox Fname
ActiveWorksheet.SaveAs Filename:=Fname, FileFormat:=51
ActiveWorkbook.Close
End If
Next sh
a SaveAs box pops up with book1.xlsx as the name of the file to be saved. My goal was to have no popup and save it in the path and file defined in fname.
What am I missing?
Thanks!
--Ben
I have the fully qualified filename stored in a string called fname. When I execute the VBA code:
For Each sh In ActiveWorkbook.Worksheets
If sh.Name = "Claims_Detail" Then
sh.Copy
Call formatit
MsgBox Fname
ActiveWorksheet.SaveAs Filename:=Fname, FileFormat:=51
ActiveWorkbook.Close
End If
Next sh
a SaveAs box pops up with book1.xlsx as the name of the file to be saved. My goal was to have no popup and save it in the path and file defined in fname.
What am I missing?
Thanks!
--Ben
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Guys! And Rob, thanks for answering the follow-up question before I had a chance to ask it! :)
Eventually I'll get a good handle on VBA. Much appreciated.
--Ben
Eventually I'll get a good handle on VBA. Much appreciated.
--Ben
Glad to be of help and can obviously see into the future, maybe I ought to buy a Lotto ticket!!
ActiveWorksheet.SaveAs should be ActiveWorkbook.SaveAs.
Open in new window