Diasabling Macro PopUp

  • Thread starter Thread starter prafulla
  • Start date Start date
P

prafulla

Hi,
I have used office automation to automate word,excel and
powerpoint.For this task, i have to disable warning that pop ups when
opening files that contains macros.

I tried by setting AutomationSecurity to
msoAutomationSecurityForceDisable but it does not works.

Can any one please suggest me other ways to completely disable these
warnings during

office automation process using C#?

Regards
Prafulla
 
You need to set that same setting to

Application.AutomationSecurity =msoAutomationSecurityLow

As I'm sure you've noticed, ForceDisable stopped execution.
 
Hi,
Actually I tried by setting pplication.AutomationSecurity
=msoAutomationSecurityLow and msoAutomationSecurityForceDisable.But
it still does not works.

The warning still pop ups while opening the office file(word,excel and
power point) and stops the execution flow of the program.

I want these warning dialog to be suppressed such that that normal
flow of the program is not hindered.

Thank you.

Regards,
Prafulla
 
Here is code I use in an application I run almost daily with no issues.

Application.AutomationSecurity = msoAutomationSecurityLow
On Error Resume Next
Set oWB = Workbooks.Open(newPath, UpdateLinks:=False, _
ReadOnly:=True)
On Error GoTo 0
Application.AutomationSecurity = msoAutomationSecurityByUI

Are you doing things in Excel and another application and it shows up?
 
Hi,

I have used c# for may office automation task.My code goes as
follows.

Microsoft.Office.Interop.Word.ApplicationClass appWord = new
Microsoft.Office.Interop.Word.ApplicationClass();
appWord.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityLow;
doc = app.Documents.Open(...) ----->The dialog box appears here
and execution halts.
app.AutomationSecurity =
MsoAutomationSecurity.rchmsoAutomationSecurityByUI;
..............

Further, i have to deal this problem in doc, xls and ppt files and
these files that contain macro may appear as an individual file or as
an embedded file inside other files(including doc,ppt, xls or other
documents).

Please, suggest me a solution to suppress the dialog box so that the
execution of the program does not halts when opening the file that
contains macro(s).

Regards,
Prafulla
 
Hi,
I have used c# for office automation.My code goes as follows:

Microsoft.Office.Interop.Word.ApplicationClass appWord = new
Microsoft.Office.Interop.Word.ApplicationClass();
appWord.AutomationSecurity
=Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityLow;
doc = appWord.Documents.Open(...)----------->In this code the diaolog
box popups and code halts.
appWord.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityByUI
..............

Further, i have to deal with all three types of the document files
doc,xls and ppt.They can appear as a single document or as an embedded
document(a word file can appear embedded inside doc,xls or ppt or any
other document like ppt).

As, i already have mentioned, please suggest me how can i suppress
the dialog box so that the execution flow of the program does not
halts at the mentioned line.Thank you.

Regards,
Prafulla
 
Back
Top