ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Diasabling Macro PopUp (https://www.excelbanter.com/excel-programming/418933-diasabling-macro-popup.html)

prafulla

Diasabling Macro PopUp
 
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

Barb Reinhardt

Diasabling Macro PopUp
 
You need to set that same setting to

Application.AutomationSecurity =msoAutomationSecurityLow

As I'm sure you've noticed, ForceDisable stopped execution.
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"prafulla" wrote:

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


prafulla

Diasabling Macro PopUp
 
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

Barb Reinhardt

Diasabling Macro PopUp
 
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?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"prafulla" wrote:

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


prafulla

Diasabling Macro PopUp
 
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.msoAut omationSecurityLow;
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

prafulla

Diasabling Macro PopUp
 

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.msoAu tomationSecurityLow;
doc = appWord.Documents.Open(...)-----------In this code the diaolog
box popups and code halts.
appWord.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAut omationSecurityByUI
..............

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


All times are GMT +1. The time now is 03:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com