Macro erroring out when I execute

ariel20029

Board Regular
Joined
Jun 20, 2013
Messages
97
Dim FName As String
Dim FPath As String

FPath = "C:\PS CREDIT"
FName = Sheets("Request Form").Range("C80").Text
ActiveWorkbook.SaveAs FileName:=FPath & "" & FName
MsgBox "File Saved to PS CREDIT folder"


Hi When I try to run this macro I am getting an error message at the ActiveWorkbook Save as file name-

saying method saveas workbook failed. Please help.
Sharon
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Dim FName As String
Dim FPath As String

FPath = "C:\PS CREDIT"
FName = Sheets("Request Form").Range("C80").Text
ActiveWorkbook.SaveAs FileName:=FPath & "\" & FName
MsgBox "File Saved to PS CREDIT folder"

Hi When I try to run this macro I am getting an error message at the ActiveWorkbook Save as file name-
Hard to know for sure what is wrong without knowing what ends up in the FName variable, but my guess is you are missing the backslash between the path and the filename. It looks like you anticipated it in your code but forgot to place it between the double quotes as shown in red above. Note the character looks like a vertical bar instead of a backslash because the backslash is distorted by the italic font used by this forum for quoted code.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,759
Messages
6,132,550
Members
449,735
Latest member
Gary_M

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