Run Time error.

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
558
Office Version
  1. 365
Platform
  1. Windows
I have the following code for a save as macro.

Code:
Sub SAVE_EVAL()

Application.ScreenUpdating = False

Dim FSName As String

'   File name in this cell is a formula that includes .xlsm at the end of the string

FSName = Sheets("Intro Page").Range("DP6").Value

ActiveWorkbook.SaveAs FileName:=FSName, FileFormat:=52

Application.ScreenUpdating = True


End Sub

When I run it it flags the "ActiveWorkbook.SaveAs FileName:=FSName, FileFormat:=52" line and throws the Run-time error '1004' Method 'SaveAs' of object '_Workbook' failed.

The text in the cell DP6 = G:\HR\Employees\Evals\Duck_Donald_25-JUN-2019.xlsm
What is causing this error? Could it be related to the folder security settings?I appreciate any help on what this error means and how to correct it.

Thanks for all help provided.

Robert
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
(untested )try removing: , FileFormat:=52
Then check and see if it still saves as a .xlsm file since you had that accounted for in the FileName
 
Last edited:
Upvote 0
@rjplante, your code saves correctly for me if I change the first part of your address strings to one of my file paths.

Can you save to that file path manually?

P.S. please don't remove the FileFormat:=52 as it will only cause an error if the file wasn't originally an xlsm.
P.P.S. I am assuming by what you have as the filepath that you aren't working with a MAC.

Edit: where is the macro stored, is it in the same file as the file being saved?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,923
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top