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 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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