DATA Step, Macro, Functions and more

Is it possible to run Excel VBA code using SAS

Reply
Contributor
Posts: 22

Is it possible to run Excel VBA code using SAS


Hi All,

I want to create a excel pivot with SAS by running VBA code .

Regards

Karthik

Regular Contributor
Posts: 244

Re: Is it possible to run Excel VBA code using SAS

I would look into DDE, if you can (google "SAS Excel DDE").  That allows SAS to tell Excel to do things, including run macros.

Super Contributor
Posts: 339

Re: Is it possible to run Excel VBA code using SAS

DDE has not been supported since 2003 maybe even earlier than that and is dying with 64 bit platforms/remote submission environments like EG or grid. Nonetheless, for local processes it can still achieve the desired results easier and faster than with some other means.

However, if you are looking for an expandable solution that will work for a long time, I would stay away from DDE.

If you have VBA knowledge, odds are it would be easier to do the opposite. I suggest you give a read to

https://communities.sas.com/thread/9841

I'd love to provide more insights but I've really only played with DDE myself and have not had anything of large enough scale to get into VB-SAS interaction

Vince

*edit Reeza -> Like!

Super User
Posts: 17,737

Re: Is it possible to run Excel VBA code using SAS

That solution assumes you have SAS Add in for Microsoft Office, which to me, in my experience is more unstable.

I'd go DDE. Currently using it with 64 bit SAS with 32 bit Excel 2010 and not having issues.  But generally, I embed a macro into the Sheet and then call that macro instead of using DDE to actually do things. 

There's also the ODS TableEditor option

Base SAS: Creating a Data Grid Like VB.NET

This is an old question, if the OP googled they'd find the answer easy enough Smiley Happy

Super User
Posts: 17,737

Re: Is it possible to run Excel VBA code using SAS

Yes its possible.

Ask a Question
Discussion stats
  • 4 replies
  • 1523 views
  • 1 like
  • 4 in conversation