Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Problem Running Code in Excel 2003

The following code runs in Excel 2002, but not in Excel 2003. This code was
run on a entirely different machine running Excel 2003.

It gets hung-up on the "For" statement.

Dim vbModule As Object
For Each vbModule In appWB.ActiveWorkbook.VBProject.VBComponents
If vbModule.Type = 1 Then ' "1" is a module
appWB.ActiveWorkbook.VBProject.VBComponents.Remove vbModule
End If
Next vbModule

The error message is "Run Time Error '1004' Programmatic access to Visual
Basic Project is not trusted"

I have checked the "Trust Access to Visual Basic Project" box on the
Macro/Security/Trusted Sources window. This worked for Excel 2002 but not
for 2003.

Any ideas?

Thanks Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Problem Running Code in Excel 2003

Check the "Trust access to Visual Basic Project" checkbox through:
ToolsMacrosSecurityTrusted Sources tab

Regards,
Greg

P.S. It's taking roughly 12 hours for my posts to appear lately so this
explains it if you receive this rather late.

"Mark" wrote:

The following code runs in Excel 2002, but not in Excel 2003. This code was
run on a entirely different machine running Excel 2003.

It gets hung-up on the "For" statement.

Dim vbModule As Object
For Each vbModule In appWB.ActiveWorkbook.VBProject.VBComponents
If vbModule.Type = 1 Then ' "1" is a module
appWB.ActiveWorkbook.VBProject.VBComponents.Remove vbModule
End If
Next vbModule

The error message is "Run Time Error '1004' Programmatic access to Visual
Basic Project is not trusted"

I have checked the "Trust Access to Visual Basic Project" box on the
Macro/Security/Trusted Sources window. This worked for Excel 2002 but not
for 2003.

Any ideas?

Thanks Mark

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
Excel 2003 code, problem in Excel 97 brianbishop Excel Discussion (Misc queries) 1 July 26th 06 04:35 PM
I am running Excel 2003 from Office 2003 Professional Tillso Excel Discussion (Misc queries) 1 October 21st 05 03:27 PM
Problem running code behind a userform cdb Excel Programming 17 February 10th 05 03:53 PM
Problem with Running VBA code on Cell Change Marty Excel Programming 8 January 18th 05 04:01 AM
Running Code on Each Sheet in an Excel Workbook bearie Excel Programming 2 February 6th 04 03:54 PM


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

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

About Us

"It's about Microsoft Excel"