Saving a Workbook as a Different Name

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
714
Office Version
  1. 365
Platform
  1. Windows
I'm trying to save a workbook as a different name, where the name of the workbook is the value of a form textbox.

Here's the code that I've pieced together, but I'm getting an "Expected = " error on the line in red font.

Code:
Private Sub cmd_Submit_Click()

Dim ws2, ws3 As Worksheet
Dim CS As Workbook
Dim CSPath As String
Dim CSFName As String


Set ws2 = ThisWorkbook.Sheets("Summaries")
Set ws3 = ThisWorkbook.Sheets("Bios")
Set CSPath = "C:\Users\Rodger\Desktop\Bodies by Trish\"
Set CS = Workbooks.Open("C:\Users\Rodger\Desktop\Bodies by Trish\CS_Template.xlsm")
Set CSFName = Me.txt_ClientID


CS.Sheets("Bio").Range("E2").Value = Me.txt_ClientID.Value


CS.Activate
[COLOR=#ff0000]activeworkbook.SaveAs (Filename:="CSPath & CSFName",FileFormat:=52)[/COLOR]


End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,222
Members
453,024
Latest member
Wingit77

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