Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Programmatic Access to Visual Basic Project is not Trusted

Hello,

I have a long program written in Excel 97 and I have transferred to Excel 2000 when I run it, it gave me the following error:

Run time error '1004'
Programmatic Access to Visual Basic Project is not Trusted

due to the section of the codes below:

'--------------------Prepare Modules in New Workbook--------------------
'Copy Modules
ModName = ThisWorkbook.Path & "\Merit Worksheet Code.txt"
For Each VBComponent In ThisWorkbook.VBProject.VBComponents
'Perform export and import module other than Excel objects
If VBComponent.Type < vbext_ct_Document Then

'Export Module Import Module Delete Module Code File
VBComponent.Export ModName
NewBook.VBProject.VBComponents.Import ModName
Kill ModName
End If

Next VBComponent
'--------------------------------------------------------------------------

It worked fine in the Excel 97 why isn't it working for on my Excel 2000? Any hint would be greatly appreciated. Thanks.

Anson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Programmatic Access to Visual Basic Project is not Trusted

Hi Anson,

You must mean Excel 2002 or 2003. A new macro security setting was added
to Excel 2002 that you must "approve" in order to perform almost any VBA
manipulation of objects that are part of the VBProject of a workbook. Choose
Tools/Macro/Security from the Excel menu, select the Trusted Sources tab and
put a check in the checkbox called "Trust Access to Visual Basic Project".

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Anson" wrote in message
...
Hello,

I have a long program written in Excel 97 and I have transferred to Excel

2000 when I run it, it gave me the following error:

Run time error '1004'
Programmatic Access to Visual Basic Project is not Trusted

due to the section of the codes below:

'--------------------Prepare Modules in New Workbook--------------------
'Copy Modules
ModName = ThisWorkbook.Path & "\Merit Worksheet Code.txt"
For Each VBComponent In ThisWorkbook.VBProject.VBComponents
'Perform export and import module other than Excel objects
If VBComponent.Type < vbext_ct_Document Then

'Export Module Import Module Delete Module Code File
VBComponent.Export ModName
NewBook.VBProject.VBComponents.Import ModName
Kill ModName
End If

Next VBComponent

'--------------------------------------------------------------------------

It worked fine in the Excel 97 why isn't it working for on my Excel 2000?

Any hint would be greatly appreciated. Thanks.

Anson



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Programmatic Access to Visual Basic Project is not Trusted

Hi Anson

You can add this code to the workbook.
http://www.j-walk.com/ss/excel/tips/tip96.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rob Bovey" wrote in message ...
Hi Anson,

You must mean Excel 2002 or 2003. A new macro security setting was added
to Excel 2002 that you must "approve" in order to perform almost any VBA
manipulation of objects that are part of the VBProject of a workbook. Choose
Tools/Macro/Security from the Excel menu, select the Trusted Sources tab and
put a check in the checkbox called "Trust Access to Visual Basic Project".

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Anson" wrote in message
...
Hello,

I have a long program written in Excel 97 and I have transferred to Excel

2000 when I run it, it gave me the following error:

Run time error '1004'
Programmatic Access to Visual Basic Project is not Trusted

due to the section of the codes below:

'--------------------Prepare Modules in New Workbook--------------------
'Copy Modules
ModName = ThisWorkbook.Path & "\Merit Worksheet Code.txt"
For Each VBComponent In ThisWorkbook.VBProject.VBComponents
'Perform export and import module other than Excel objects
If VBComponent.Type < vbext_ct_Document Then

'Export Module Import Module Delete Module Code File
VBComponent.Export ModName
NewBook.VBProject.VBComponents.Import ModName
Kill ModName
End If

Next VBComponent

'--------------------------------------------------------------------------

It worked fine in the Excel 97 why isn't it working for on my Excel 2000?

Any hint would be greatly appreciated. Thanks.

Anson





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
Trust access to visual basic project in XP systems kasi Excel Discussion (Misc queries) 5 October 13th 05 01:32 PM
Trust access to visual basic project greyed out Amit Shanker Excel Discussion (Misc queries) 2 March 5th 05 09:41 PM
Registry key for "Trust access to Visual Basic project" tmarko[_13_] Excel Programming 3 June 14th 04 10:40 AM
'Programmatic access to Visual Basic project is not trusted.' message Joe Excel Programming 1 February 13th 04 03:19 PM
Allow access to visual basic project netzig Excel Programming 2 February 4th 04 06:06 PM


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

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"