Programmatically preventing macros issues

L

Lew

I'm writing an automation project which involves extracting data from ss
we receive from a bewildering number of sources, and we're afraid of the
possibility that my app may trigger a malicious macro. I understand that
I've got to set the AutomationSecurity value to 3, but I've still got a few
questions.
First: The tools->macros->security tab has 4 values; why can I only set
the AutomationSecurity value to 1, 2 or 3 (ie only 3 possible values)?
Second: If I set AutomationSecurity to 3 and, since we plan to disable
user interaction with excel while my app is running by making excel
invisible, is there any possibility that a macro (or anything else) could
trigger a dialog requiring user input & resulting in an apparent hang? If
yes, will DisplayAlerts = false take care of this? Please bear in mind that
the only thing we're doing (as of now anyway) is pulling values out of
cells, not anything that I see as requiring interaction.
Other suggestions or things to watch out for?
TIA!
 
E

Eric Lachowitz

If I am understand your problem correctly...

Have you tried assigning a personal digital certtificate to your
project file/VBA application and setting the macro level to High in
Excel?

Microsoft office allows you to make digital certificates for just that
purpose - so you can be prompted before you accept running a macro
from an untrusted source only once (trust those you want - discard
those you don't - in this case you will be trusting your file and
disgarding the data source macros without the hassle of being
prompted).

To make a certificate: Start > Microsoft Office > Office Tools >
Digital Certificates for VBA Projects

To apply it to your project file: In your VBA editor under tools >
Digital Signature

....I think this is what you were asking and is one way to go about
trying to work around security.

Good Luck.

-Eric
 
T

Tom Ogilvy

If you are using the clipboard and have a large amount of data, when you
attempt to close the file you could get a prompt to retain the information
in the clipboard.

You can suppress this with DisplayAlerts or you can copy an individual cell
to the clipboard before closing the workbook.
 
L

Lew

Thanks, Eric:
No, we're automating data extraction into corporate data stores. The dev
platform is Visual FoxPro and we're not running any macros. Sorry if I
wasn't clear enough.
-Lew
 
L

Lew

Guess I didn't say enough. The data is being pulled out by my VFP code into
corporate data stores. This allows us to have a single platform for pulling
from a large variety of sources ... (text, word, excel, ftp stuff, etc...)
-Lew
Tom Ogilvy said:
If you are using the clipboard and have a large amount of data, when you
attempt to close the file you could get a prompt to retain the information
in the clipboard.

You can suppress this with DisplayAlerts or you can copy an individual
cell to the clipboard before closing the workbook.
 
T

Tom Ogilvy

I guess that would mean you using ADO.

If your using ADO, then you don't start the excel application and you should
not get any prompts except for errors.

--
Regards,
Tom Ogilvy

Lew said:
Guess I didn't say enough. The data is being pulled out by my VFP code
into corporate data stores. This allows us to have a single platform for
pulling from a large variety of sources ... (text, word, excel, ftp stuff,
etc...)
-Lew
 
L

Lew

Hi Tom:
VFP uses the excel com interface. I can grab an existence of the
excel.application object if one exists in the desktop environment or create
one if necessary, so I'm using the excel internals to get at the data, not
ADO (unless, of course, excel itself uses ADO to manage its own data).
-Lew
 
L

Lew

I don't understand. The original answer was about digital certificates and
writing macros in vba. We are *not* using either one.
 
L

Lew

Sorry, I thought you meant the original answer to my post from Eric
Lachowitz. If the following is your original answer:

If you are using the clipboard and have a large amount of data, when you
attempt to close the file you could get a prompt to retain the information
in the clipboard.
You can suppress this with DisplayAlerts or you can copy an individual cell
to the clipboard before closing the workbook.

I remain at a loss. We're not using the clipboard, but we will be closing
files that we open. However, they will remain unchanged and should not
trigger a file save dialog.

Can you tell me anything about the excel AutomationSecurity property? For
instance, why are there 4 settings on the tools->macro->Security Level tab
whereas I can only set the property to 1, 2 or 3?

Thanks for your patience.
 
T

Tom Ogilvy

xl2000/xl2002, only have three values that I can see.

I don't have xl2003 installed right now to check

the automationsecurity setting allows you to enable or disable macros for a
file your code is opening (or to let it default to the user selected
security setting). It doesn't allow you to change the users settings. It
allows you to overide them for your macro.

Can your macro trigger a dialog - sure, the setting has nothing to do with
that. Application.DisplayAlerts will work with the same dialogs it works
with in VBA. Not all dialogs are suppressed by displayalerts.
 
D

Dave Peterson

Same with xl2003 (only 3 settings).

Maybe xl2003's help will help the OP:

MsoAutomationSecurity can be one of these MsoAutomationSecurity constants.

msoAutomationSecurityByUI Uses the security setting specified in the Security
dialog box.

msoAutomationSecurityForceDisable Disables all macros in all files opened
programmatically without showing any security alerts.

msoAutomationSecurityLow Enables all macros. This is the default value when the
application is started.
 
E

Eric Lachowitz

I am unsure as to when... I am running 2003 (but I think that office
tool has been around for a while)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top