BookmarkSubscribeRSS Feed
ganeshsas764
Obsidian | Level 7

Hi Team,

 

Can you please advise me how to run the VBA Macro through SAS 9.4,

 

 

Thanks & regards 

A Ganesh

6 REPLIES 6
ganeshsas764
Obsidian | Level 7
Thank you,

But I want only execute the VBA macro, no need to export any data to excel
file.
Reeza
Super User

DDE. Use google to find examples.

ganeshsas764
Obsidian | Level 7

Hi ,

 

I tried below-mentioned code but I am getting error,

 

options noxwait noxsync;
x '"C:\Program Files\Microsoft Office\Office\excel.exe" ';
/* Sleep for 5 seconds to give Excel time to come up */
data _null_;
x=sleep(5);
run;
filename cmds dde 'excel|system';
data _null_;
file cmds;
/* Open the excel file test.xlsm which contains the VBA macro */
put '[open("c:\temp\test.xlsm")]';
/* Run myVBAmacro */
put '[run("test.xlsm!myVBAmacro")]';
run;

 

ballardw
Super User

@ganeshsas764 wrote:

Hi ,

 

I tried below-mentioned code but I am getting error,

 

 


When you get errors it really helps to share the actual error. Best is to copy the code submitted with the error and other messages from log and paste into a code box opened using the forum {I} icon. The code box will preserve formatting of error messages.

 

Note that DDE may be interfered with by other programs that are running on your computer. I know that Cisco Jabber is one and that the process, not just  the application window, have to be killed before DDE will work on my computer.

art297
Opal | Level 21

If @PeterClemmensen is right, and you are looking to run VB script from SAS, you can run it by using:

call system(yourVBscript.);

The updated version of the paper that @PeterClemmensen mentioned, which is a SAS macro that both creates and runs VB script, can be found at: http://www.sascommunity.org/wiki/Excelling_to_Another_Level_with_SAS

 

Art, CEO, AnalystFinder.com

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 5136 views
  • 2 likes
  • 5 in conversation