macro for save as and macro-free display

shawrod

Active Member
Joined
Oct 1, 2010
Messages
399
I am using this code :

Private Sub CommandButton3_Click()
Dim FName As String
Dim FPath As String

FPath = "\\my-PC\myfolder"
FName = Sheets("Car").Range("C1").Text
ThisWorkbook.SaveAs Filename:=FPath & "\" & FName, FileFormat:=51
Application.Quit
End Sub

but as soon as I run the code. I get this dialogue poped up which is annoying:
" The following feature cannot be saved in ......
to continue to save as macro-free workbook click yes"
which my answer is yes but how do I get rid of this message because I am already saving the file in 51 (macro free) as you see my code above. so I don't understand why it is asking again. Anybody know how to get rid of this annoying pop-up?
 
Welcome to the MrExcel board!

Try adding the blue lines of code where shown.
Rich (BB code):
Application.DisplayAlerts = False
ThisWorkbook.SaveAs Filename:=FPath & "\" & FName, FileFormat:=51
Application.DisplayAlerts = True
 
Upvote 0
Maybe try something like this...

Code:
Private Sub CommandButton3_Click()

    Dim FName As String
    Dim FPath As String
    
    FPath = "\\my-PC\myfolder"
    FName = Sheets("Car").Range("C1").Text
    [COLOR="Red"]Application.DisplayAlerts = False[/COLOR]
    ThisWorkbook.SaveAs Filename:=FPath & "\" & FName, FileFormat:=51
    [COLOR="Red"]Application.DisplayAlerts = True[/COLOR]
    Application.Quit
    
End Sub
 
Upvote 0
You guys are awesome! Thank you so much. It did work. you have no idea much time I spent on it and I couldn't figure it out.
 
Upvote 0

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