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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,982
Office Version
  1. 2016
Platform
  1. Windows
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"
 

peter_theo

New Member
Joined
May 29, 2015
Messages
3
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
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,982
Office Version
  1. 2016
Platform
  1. Windows
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?
 

peter_theo

New Member
Joined
May 29, 2015
Messages
3
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,444
Messages
5,642,188
Members
417,259
Latest member
gtacw

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
Top