Format 51

billandrew

Well-known Member
Joined
Mar 9, 2014
Messages
743
Good Evening

Looking for some assist here. I am saving a workbook whichcontains several worksheets. When the new file is created there are two issues.

1. Message indicating to save the new file as an xlsx not amacro enabled file.

2. The new Worksheet the sheets have been grouped.

How can I avoid each of the above.

The code I am currently working with is:

Code:
Sub SaveE()
Dim Mypath As String
Dim Filename As String
Mypath = Environ("USERPROFILE") & "\Desktop\"
Filename = CreateObject("Scripting.FileSystemObject").GetBaseName(ActiveWorkbook.Name)
Sheets.Select
ActiveWorkbook.SaveAs Filename:=Mypath & " " & Filename & " " & ".xlsx", FileFormat:=51
End Sub

 
See if the below is close (untested)

Code:
Sub SaveE()
    Dim Mypath As String, mywkbk As Workbook
    Dim Filename As String
    Set mywkbk = ActiveWorkbook
    ActiveWorkbook.Sheets.Copy
    Mypath = Environ("USERPROFILE") & "\Desktop\"
    Filename = CreateObject("Scripting.FileSystemObject").GetBaseName(mywkbk.Name)
    ActiveWorkbook.SaveAs Filename:=Mypath & Filename & ".xlsm", FileFormat:=52
End Sub
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Works Perfect! The File Format I was looking for was 51. Changed it with no issues.Thank You once again...
 
Upvote 0
Works Perfect! The File Format I was looking for was 51. Changed it with no issues.Thank You once again...

Now I'm puzzled by the below I thought you wanted to save it as a macro enabled workbook?

1. Message indicating to save the new file as an xlsx not amacro enabled file.
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

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