ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem Running Code in Excel 2003 (https://www.excelbanter.com/excel-programming/332019-problem-running-code-excel-2003-a.html)

Mark

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

Greg Wilson

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



All times are GMT +1. The time now is 12:16 PM.

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