Use macros button functions in xlsx

brothaprice

New Member
Joined
Dec 12, 2020
Messages
13
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Web
How can I save the functions for these buttons in an external vba script that I can make a call to? The macros I create gets removed when I close the xlsx file and I do not want to make it a xlsm file to work around the issue.

1613668889355.png
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,962
Not tested here :

VBA Code:
Sub Test()
Dim wb As Workbook, wb2 As Workbook
Dim Path As String
Application.DisplayAlerts = False
Path = "C:\Users\" & Environ("Username") & "\Desktop\"
Set wb = ThisWorkbook
wb.SaveCopyAs (Path & "File.xlsm")
Set wb2 = Workbooks.Open(Path & "File.xlsm")
wb2.SaveAs Path & "File1.xlsx", xlOpenXMLWorkbook
wb2.Close
Application.DisplayAlerts = True
End Sub

after run macro to save as xlsx file, the macro file convert to xlsx file
 

brothaprice

New Member
Joined
Dec 12, 2020
Messages
13
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Web
Hi Steve. Just for end users that open my file that are only used to xlsx.
I once created a splash page and had to use a macro workbook. I was getting funny warning messages. I am not this time. I might leave it as is.
 

brothaprice

New Member
Joined
Dec 12, 2020
Messages
13
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Web
Not tested here :

VBA Code:
Sub Test()
Dim wb As Workbook, wb2 As Workbook
Dim Path As String
Application.DisplayAlerts = False
Path = "C:\Users\" & Environ("Username") & "\Desktop\"
Set wb = ThisWorkbook
wb.SaveCopyAs (Path & "File.xlsm")
Set wb2 = Workbooks.Open(Path & "File.xlsm")
wb2.SaveAs Path & "File1.xlsx", xlOpenXMLWorkbook
wb2.Close
Application.DisplayAlerts = True
End Sub

after run macro to save as xlsx file, the macro file convert to xlsx file
This is something I could try. I might test this at a later date.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,498
Messages
5,625,123
Members
416,073
Latest member
JosGosth98

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