Vba

peter_theo

New Member
Joined
May 29, 2015
Messages
3
Please advise what is the problem with this line. It keeps giving an error and I can't understand the reason. I am newly playing with VBA automating some functions and commands in my excel sheets.
Thanking you in advance for any enlightenment given.

ActiveWorkbook.SaveAsFilename: = Path & FileName1 & "-" & FileName2 & "-" & FileName3 & ".xlsm", FileFormat:=xlNormal
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Please advise what is the problem with this line. It keeps giving an error and I can't understand the reason. I am newly playing with VBA automating some functions and commands in my excel sheets.
Thanking you in advance for any enlightenment given.

ActiveWorkbook.SaveAsFilename: = Path & FileName1 & "-" & FileName2 & "-" & FileName3 & ".xlsm", FileFormat:=xlNormal
It looks like you need a space between the "SaveAs" and "Filename"
 
Upvote 0
It looks like you need a space between the "SaveAs" and "Filename"

Dear Rick many thanks for the response. Please see bellow the whole code and help me out as the SaveAs line is driving me nuts...

Private Sub CommandButton1_Click()
Dim Path As String
Dim FileName1 As String
Dim FileName2 As String
Dim FileName3 As String
Path = "C:\MarketsActions\"
FileName1 = Range("AA3") 'PeruActions
FileName2 = Range("AB3") 'Text(Todate(),"yyyymmdd")
FileName3 = Range("AC3") 'Text(Now(),"HHMMSS")
ActiveWorkbook.SaveAs Filename:=Path & FileName1 & "-" & FileName2 & "-" & FileName3 & ".xlsm", FileFormat:=52
End Sub
 
Upvote 0
Dear Rick many thanks for the response. Please see bellow the whole code and help me out as the SaveAs line is driving me nuts...
What is happening, or not happening, that is "driving you nuts"?

Are you getting an error message? If so, what is its number and description?
 
Upvote 0
It Works Perfect now and not even sure why... The only thing I noticed is that I opened the excel file with another computer with also Office 2007, but and the Big But is that the button Save is not working. Why is that? Does the other user has to have VBA to run the micro?
Please advise. Thank you so much for all the help.
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,249
Members
448,879
Latest member
oksanana

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