DATA Step, Macro, Functions and more

Avoiding the "This Excel sheet contains macros"-prompt

Reply
Contributor
Posts: 24

Avoiding the "This Excel sheet contains macros"-prompt

Hello,

With the following code, I am opening Excel, opening a specific file and running a macro in that file. The only problem is that between opening the specific file and running the macro it contains, Excel pops up with the prompt that asks me if I want to run the file with or without macros, and I have to manually choose "With macros" before my SAS program continues. Can I get SAS to either ignore this prompt or to automatically choose "With macros"?

Edit: By the way, I would like my code to be able to run on other people's computers as well, so the solution where I turn off the prompt in Excel is a last way out.

START OF CODE.

x ' "C:\Program Files\Microsoft Office\OFFICE11\excel.exe" ';

filename EXCEL DDE 'EXCEL|SYSTEM';

data _null_;

     x = sleep(3);
run;

data _null_;
     file excel;

     put '[open("L:\sasdata\Test\rhk\skrbest15\rapporteringsmakro.xls")]';
     put '[RUN("rapporteringsmakro.xls!Rapportering")]';

run;

END OF CODE.

Kind regards,

Rasmus Hedegaard.

Trusted Advisor
Posts: 2,113

Re: Avoiding the "This Excel sheet contains macros"-prompt

This is a tough one.  I think that message is present (or suppressed) based on a registry setting in Windows.  If the users have a certain amount of administrative access to their own computers, you could use any one of the registry editing programs to set up a small executable to modify the registry.  If not, your network admins would have to do it with their tools.

Ask a Question
Discussion stats
  • 1 reply
  • 181 views
  • 0 likes
  • 2 in conversation