Generate .VBS script with a .VBA code

Judgedread

New Member
Joined
Apr 16, 2014
Messages
16
Good afternoon,

My first post on the famous Mr.Excel.com. Hope I would post a question that has been answered thousands times.

I need to create a .VBS document/script from an excel sheet. Is there any easy way to do a "save-as" and choose the .VBS extension ?

Once the .VBS is created, I would like my macro to open it so it perform automatically an extraction from SAP system. I'll then import this extraction in my excel document.

But right now my main concern is : is it possible to create a .VBS document from excel using vba code ? if yes how ?

Many thanks guys for your help on that !
Take care
Judge
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Just save it as a text file with a vbs extension.
 
Upvote 0
Code:
ActiveSheet.SaveAs "C:\myPath\myFile.vbs", FileFormat:=xlTextWindows
 
Upvote 0
Works great many thanks !

I'll now work on how to run this .vbs file and import the result after the vbs is finished.

Thanks again,
Cheers
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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