Import a macro into a .xlsx file without opening Visual Basic for Applications

sspatriots

Well-known Member
Joined
Nov 22, 2011
Messages
585
Office Version
  1. 365
Platform
  1. Windows
Is it possible to import a macro into a .xlsx file without having to open Visual Basic for Applications? I have a macro that I wrote that multiple users will only import to use one time. The macro only changes the printer setup and printer configuration for a one time use. We don't even save the .xlsx as a .xlsm when we are done. We just close the file. I could generate an instruction on how to import the macro using Visual Basic for Applications, but I think users would get nervous as soon as that VB screen pops open. Was hoping to find a way to avoid opening it and still access the macro to change the print settings for that one time use.


Thanks, SS
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Is it possible to import a macro into a .xlsx file without having to open Visual Basic for Applications? I have a macro that I wrote that multiple users will only import to use one time. The macro only changes the printer setup and printer configuration for a one time use. We don't even save the .xlsx as a .xlsm when we are done. We just close the file. I could generate an instruction on how to import the macro using Visual Basic for Applications, but I think users would get nervous as soon as that VB screen pops open. Was hoping to find a way to avoid opening it and still access the macro to change the print settings for that one time use.


Thanks, SS
Depending on the code you're using, you wouldn't need to use VBA at all - for tasks like the one you're using VBA for, you could just convert it into VBScript (which is a subset of VB) and run it from Windows. For what you're describing, it's pretty much what VBScript was designed for - for IT departments in companies to run things on users computers (like printer configurations, etc), but again, it depends on the actual code you've got.
 
Upvote 0
Depending on the code you're using, you wouldn't need to use VBA at all - for tasks like the one you're using VBA for, you could just convert it into VBScript (which is a subset of VB) and run it from Windows. For what you're describing, it's pretty much what VBScript was designed for - for IT departments in companies to run things on users computers (like printer configurations, etc), but again, it depends on the actual code you've got.
Thanks. I will need to read up on VB Script and give it a shot.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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