VBA Solution External Data Connection Prompt

jstevens
GoldLounger
Posts: 2618
Joined: 26 Jan 2010, 16:31
Location: Southern California

VBA Solution External Data Connection Prompt

Post by jstevens »

Other than changing settings in Options>Trust Center>Trust Center Settings is it possible to click on the "Enable Content" button using VBA?
EL_96.PNG
You do not have the required permissions to view the files attached to this post.
Regards,
John

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: VBA Solution External Data Connection Prompt

Post by LisaGreen »

Yes... but it's not simple.

It may be possible that you could use sendkeys... I'm not sure.

What I do to press a button on a dialog box is spawn a new instance of the application and write code to it's vbe that looks through all the windows till it finds the one with the button header and then use sendmessage to press the button.

You can't use sendmessage from the same instance you're running because the application is waiting for you to press Enable Content or whatever.

Lisa

jstevens
GoldLounger
Posts: 2618
Joined: 26 Jan 2010, 16:31
Location: Southern California

Re: VBA Solution External Data Connection Prompt

Post by jstevens »

Thanks Lisa!

I had tried using the Macro recorder from a different workbook but it did not record code other than changing to the workbook which required the "Enable Content" button.
Regards,
John

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: VBA Solution External Data Connection Prompt

Post by LisaGreen »

Ahhhh... I just reread the question and my previous answer doesn't really apply I think. If macros are not enabled then nothing can be run! bottom!

A way around this is to open the file from a different program/instance.

Many apologies.

Lisa