VBA code to save file using cell data

tkroper

Active Member
Joined
Feb 2, 2007
Messages
255
Hi Friends!

I'm making my first attempt at VBA, trying to save a file using cell data to a file location. Here's what I have:

Code:
Private Sub CommandButton1_Click()Dim Path As String
Dim FileName1 As String
Dim FileName2 As String
Path = “H:\Audit Vendor Resources\Quality Review Checklist\Reviews\”
FileName1 = Range(“D10”)
FileName2 = Range(“D9”)
ActiveWorkbook.SaveAs Filename:=Path & FileName1 & “ ” & FileName2 & “.xls”, FileFormat:=xlNormal
End Sub

The "Path" is red and so is the "ActiveWorkbook.SaveAs" line. It says I have a syntax error. Can anyone help me correct this?

Thank you :)
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Instead of using the left and right quotation marks, use the regular double quotes. So, for example, the line assigning the path would be as follows...

Code:
Path = "H:\Audit Vendor Resources\Quality Review Checklist\Reviews\"

Hope this hleps!
 
Upvote 0

Forum statistics

Threads
1,215,373
Messages
6,124,545
Members
449,169
Latest member
mm424

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