#1   Report Post  
Posted to microsoft.public.excel.misc
Steve
 
Posts: n/a
Default runtime error '1004'

A few weeks ago I found some code from this discussion group that allowed me
to delete all of the code modules from a workbook:

Set VBComps = NewBook.VBProject.VBComponents
For Each VBComp In VBComps
Select Case VBComp.Type
Case vbext_ct_StdModule, vbext_ct_MSForm, _
vbext_ct_ClassModule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp

It worked like a charm. Yesterday I got a new computer at work running XP
and Excel 2003. Now I'm getting this error message:
runtime error '1004' Programmatic access to Visual Basic Project is not
trusted.

I have my security settings on low. Any ideas of how I can make this work
again?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default runtime error '1004'

There's a setting that was added in xl2002 (IIRC). It allows the user to have
more control over the stuff that they run.

Tools|macro|security|trusted publishers tab
check that "trust access to Visual Basic Project"

This is user by user setting. It doesn't travel with the workbook.

Steve wrote:

A few weeks ago I found some code from this discussion group that allowed me
to delete all of the code modules from a workbook:

Set VBComps = NewBook.VBProject.VBComponents
For Each VBComp In VBComps
Select Case VBComp.Type
Case vbext_ct_StdModule, vbext_ct_MSForm, _
vbext_ct_ClassModule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp

It worked like a charm. Yesterday I got a new computer at work running XP
and Excel 2003. Now I'm getting this error message:
runtime error '1004' Programmatic access to Visual Basic Project is not
trusted.

I have my security settings on low. Any ideas of how I can make this work
again?


--

Dave Peterson
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
runtime error '6' overflow don Setting up and Configuration of Excel 1 July 26th 05 02:52 AM
Runtime Error '1004' [email protected] Excel Discussion (Misc queries) 2 July 18th 05 06:10 AM
runtime error '800a9c64' Dimple Wathen Excel Discussion (Misc queries) 0 July 14th 05 07:29 PM
Runtime error for macro that works in workbook created in Crystal Excel Discussion (Misc queries) 1 June 22nd 05 08:43 PM
Why do I get the runtime error message430 when I start my compute. Thorcat Setting up and Configuration of Excel 1 December 2nd 04 07:15 PM


All times are GMT +1. The time now is 01:47 PM.

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"