PC Review


Reply
Thread Tools Rate Thread

Alter macro security level programmatically

 
 
Dale Fye
Guest
Posts: n/a
 
      10th Jan 2008
I have an Access application that is opening a number of Excel spreadsheets
and reading data from them. Each of these spreadsheets has the same macros,
which I want to disable when I open the workbook, rather than having to click
the pop-up window that asks if I want to enable/disable macros.

Is there a way to do this using Excel automation? How about using API
calls? My intent is that I would like to read the current setting, change
the setting to disable macros, read in the files, then reset the setting to
its original value.

--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      10th Jan 2008
Think about it. If you could then what is the use of having security in the
first place?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Dale Fye" <(E-Mail Removed)> wrote in message
news:506EFD7E-EE98-4483-A04C-(E-Mail Removed)...
>I have an Access application that is opening a number of Excel spreadsheets
> and reading data from them. Each of these spreadsheets has the same
> macros,
> which I want to disable when I open the workbook, rather than having to
> click
> the pop-up window that asks if I want to enable/disable macros.
>
> Is there a way to do this using Excel automation? How about using API
> calls? My intent is that I would like to read the current setting, change
> the setting to disable macros, read in the files, then reset the setting
> to
> its original value.
>
> --
> Don''t forget to rate the post if it was helpful!
>
> email address is invalid
> Please reply to newsgroup only.
>


 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      10th Jan 2008
You may be able to adapt this to Access:

Sub is_it_safe()
Dim s As String
Dim s2 As String
s2 = "C:\temp\child1.xls /s"
s = "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.exe "
x = Shell(s & s2, 1)
End Sub

The idea is to open child1.xls in Excel in Office Safe Mode. This should
disable any child1 startup macro activity.
--
Gary''s Student - gsnu200764


"Dale Fye" wrote:

> I have an Access application that is opening a number of Excel spreadsheets
> and reading data from them. Each of these spreadsheets has the same macros,
> which I want to disable when I open the workbook, rather than having to click
> the pop-up window that asks if I want to enable/disable macros.
>
> Is there a way to do this using Excel automation? How about using API
> calls? My intent is that I would like to read the current setting, change
> the setting to disable macros, read in the files, then reset the setting to
> its original value.
>
> --
> Don''t forget to rate the post if it was helpful!
>
> email address is invalid
> Please reply to newsgroup only.
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      10th Jan 2008
You could use alternative approaches to read the data, for example:

How To Use ADO with Excel Data from Visual Basic or VBA
http://support.microsoft.com/kb/257819

How is Access opening the Excel workbooks? If you use VBA to open a document
with macros in an instance of its parent application, the fact that VBA is
running counts as an approval to run code, so you should not be warned.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Dale Fye" <(E-Mail Removed)> wrote in message
news:506EFD7E-EE98-4483-A04C-(E-Mail Removed)...
>I have an Access application that is opening a number of Excel spreadsheets
> and reading data from them. Each of these spreadsheets has the same
> macros,
> which I want to disable when I open the workbook, rather than having to
> click
> the pop-up window that asks if I want to enable/disable macros.
>
> Is there a way to do this using Excel automation? How about using API
> calls? My intent is that I would like to read the current setting, change
> the setting to disable macros, read in the files, then reset the setting
> to
> its original value.
>
> --
> Don''t forget to rate the post if it was helpful!
>
> email address is invalid
> Please reply to newsgroup only.
>



 
Reply With Quote
 
Dale Fye
Guest
Posts: n/a
 
      10th Jan 2008
Great idea Jon. Had not even considered using ADO to read data from Excel.
I'll take a look.

My problem stems from Access misinterpreting data types when importing or
linking to Excel, so opening an ADO recordset might just do the trick.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Jon Peltier" wrote:

> You could use alternative approaches to read the data, for example:
>
> How To Use ADO with Excel Data from Visual Basic or VBA
> http://support.microsoft.com/kb/257819
>
> How is Access opening the Excel workbooks? If you use VBA to open a document
> with macros in an instance of its parent application, the fact that VBA is
> running counts as an approval to run code, so you should not be warned.
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Tutorials and Custom Solutions
> Peltier Technical Services, Inc. - http://PeltierTech.com
> _______
>
>
> "Dale Fye" <(E-Mail Removed)> wrote in message
> news:506EFD7E-EE98-4483-A04C-(E-Mail Removed)...
> >I have an Access application that is opening a number of Excel spreadsheets
> > and reading data from them. Each of these spreadsheets has the same
> > macros,
> > which I want to disable when I open the workbook, rather than having to
> > click
> > the pop-up window that asks if I want to enable/disable macros.
> >
> > Is there a way to do this using Excel automation? How about using API
> > calls? My intent is that I would like to read the current setting, change
> > the setting to disable macros, read in the files, then reset the setting
> > to
> > its original value.
> >
> > --
> > Don''t forget to rate the post if it was helpful!
> >
> > email address is invalid
> > Please reply to newsgroup only.
> >

>
>
>

 
Reply With Quote
 
Dale Fye
Guest
Posts: n/a
 
      10th Jan 2008
I get your point, but my code is digitally signed, so it can run at the
higher security levels.

My preference was to Open the workbook, hoping that there was a way within
the GetObject or wbk.Open methods to disable the macros automatically. In
the absense of that, I was looking for any other possible alternatives, Jon's
idea to open an ADO recordset may just work.

Thanks for your feedback.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Don Guillett" wrote:

> Think about it. If you could then what is the use of having security in the
> first place?
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)
> "Dale Fye" <(E-Mail Removed)> wrote in message
> news:506EFD7E-EE98-4483-A04C-(E-Mail Removed)...
> >I have an Access application that is opening a number of Excel spreadsheets
> > and reading data from them. Each of these spreadsheets has the same
> > macros,
> > which I want to disable when I open the workbook, rather than having to
> > click
> > the pop-up window that asks if I want to enable/disable macros.
> >
> > Is there a way to do this using Excel automation? How about using API
> > calls? My intent is that I would like to read the current setting, change
> > the setting to disable macros, read in the files, then reset the setting
> > to
> > its original value.
> >
> > --
> > Don''t forget to rate the post if it was helpful!
> >
> > email address is invalid
> > Please reply to newsgroup only.
> >

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set macro security level to 'low level' on opening a certain workbook. andreashermle Microsoft Excel Programming 2 15th Nov 2010 06:33 AM
set macro security to low programmatically Chlaris Microsoft Access 4 29th Dec 2009 02:44 PM
Macro security level help? =?Utf-8?B?Q29uZnVzZWRfRXVmZnk=?= Microsoft Powerpoint 2 22nd Jul 2007 03:43 PM
Macro Security Level. =?Utf-8?B?dGVjaG5va25pZ2h0?= Microsoft Powerpoint 10 11th May 2006 09:12 AM
??Programmatically set security level to medium DG Microsoft Excel Programming 8 1st Mar 2004 10:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:02 AM.