Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Programmatically finding out if Excel macros are enabled.

How can I find out through VB 6.0 whether macros are enable in an Excel 2003
application?

I tried the following but it does not work:

Set ea = CreateObject ("Excel.Application")

' test.xls has macros
Set wb = ea.Workbooks.Open ("e:\test.xls")

' This line bombs out
MsgBox (ea.VBE.VBProjects.Count)

Any help will be appreciated. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Programmatically finding out if Excel macros are enabled.

Have you added a reference to the VBE library?
What is the text of the error you get?

Tim

--
Tim Williams
Palo Alto, CA


"Zhwgnon Flrq" <Zhwgnon wrote in message
...
How can I find out through VB 6.0 whether macros are enable in an Excel

2003
application?

I tried the following but it does not work:

Set ea = CreateObject ("Excel.Application")

' test.xls has macros
Set wb = ea.Workbooks.Open ("e:\test.xls")

' This line bombs out
MsgBox (ea.VBE.VBProjects.Count)

Any help will be appreciated. Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Programmatically finding out if Excel macros are enabled.

I got the solution.

The text of the error message was: Programmatic Access to Visual Basic
Project is unsafe.

The code was written against Excel 2000, but in XP and 2003, security has
been enhanced. The solution is documented he
http://support.microsoft.com/kb/q282830/

"Tim Williams" wrote:

Have you added a reference to the VBE library?
What is the text of the error you get?

Tim

--
Tim Williams
Palo Alto, CA


"Zhwgnon Flrq" <Zhwgnon wrote in message
...
How can I find out through VB 6.0 whether macros are enable in an Excel

2003
application?

I tried the following but it does not work:

Set ea = CreateObject ("Excel.Application")

' test.xls has macros
Set wb = ea.Workbooks.Open ("e:\test.xls")

' This line bombs out
MsgBox (ea.VBE.VBProjects.Count)

Any help will be appreciated. Thanks.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros enabled but will not run in excel 2007 Randy Excel Discussion (Misc queries) 11 October 6th 09 03:19 AM
Programmatically finding 2007 Excel and other Office GUIDs Ted Setting up and Configuration of Excel 1 December 30th 08 10:44 AM
Open workbook-macros enabled, opening another with macros George J Excel Programming 5 September 17th 04 02:07 PM
Fail if macros are not enabled? JonF Excel Programming 1 October 23rd 03 05:10 PM
Calling Excel FUNCTION MACROS Programmatically from VB Rob Bovey Excel Programming 0 July 23rd 03 09:35 PM


All times are GMT +1. The time now is 09:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"