Runtime 1004 Error SaveAs Workbook Failed

AIMbe

New Member
Joined
Sep 3, 2018
Messages
2
Hi,

I'm quite new in vba and I was hoping someone could help me.
I have the following code, that saves a copy of a sheet "Loading Form" using as a name a value in cell C7:

Sub SaveITWithNewName()
Dim NewFN As Variant

If Range("C36").Value <= 0.8 Then
MsgBox "Truck not full"
Else
ActiveSheet.Copy
NewFN = "Path to the folder" & Range("C7").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
NextLoading
End If
End Sub

I keep having an error at line "ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook" although it has worked before and suddenly started with this error...

Can someone advise?
Thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi & welcome to MrExcel
What is the value of NewFn?
 
Last edited:
Upvote 0
Also try
Code:
[COLOR=#333333]ActiveWorkbook.SaveAs NewFN, 51[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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