Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Programmactic access to Visual Basic Project is not trusted

7 views
Skip to first unread message

Peter

unread,
Nov 15, 2004, 3:01:50 PM11/15/04
to
Hello everyone,

Because of this piece fo code:
...
Dim ModuleCount as Long (?)

ModuleCount = ThisWorkbook.VBProject.VBComponents.Count
Sheets.Add After:=Sheets(ModuleCount)

I get this error message:
"Programmactic access to Visual Basic Project is not trusted"

(What good is it then?)

Does anyone know how to circumvent this?


TIA

Peter


Frank Kabel

unread,
Nov 15, 2004, 3:08:43 PM11/15/04
to
Hi
goto 'Tools - Macros - Security' and on the second tab of this dialog
allow access to the VBA project

--
Regards
Frank Kabel
Frankfurt, Germany

"Peter" <scot...@xs4all.nl> schrieb im Newsbeitrag
news:u2Fwz30y...@TK2MSFTNGP11.phx.gbl...

Ron de Bruin

unread,
Nov 15, 2004, 3:06:07 PM11/15/04
to
Hi Peter

John have a example on his site to avoid the error
http://www.j-walk.com/ss/excel/tips/tip96.htm

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


"Peter" <scot...@xs4all.nl> wrote in message news:u2Fwz30y...@TK2MSFTNGP11.phx.gbl...

keepITcool

unread,
Nov 15, 2004, 4:16:23 PM11/15/04
to
NOTE:

if you are using Excel 2003 the box in
macro security options is greyed out.

the registry setting was moved from user to machine
and you can no longer change it from the UI.

Run the program regedit.exe
goto:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Excel\Security
Add or Change a DWORD named AccessVBOM to Value 1


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam

Frank Kabel wrote in message
<news:OETc560y...@tk2msftngp13.phx.gbl>:

Frank Kabel

unread,
Nov 15, 2004, 5:22:00 PM11/15/04
to
Hi Jurgen
for me (using Excel 2003 / German) no problem to change this setting in
the UI directly. But I'm logged in as admin. So could be the reason for
this

--
Regards
Frank Kabel
Frankfurt, Germany

"keepITcool" <xrrcv...@puryyb.ay> schrieb im Newsbeitrag
news:Xns95A2E2A432B...@207.46.248.16...

Stephen Bullen

unread,
Nov 16, 2004, 4:14:43 AM11/16/04
to
Hi Peter,

> Dim ModuleCount as Long (?)
>
> ModuleCount = ThisWorkbook.VBProject.VBComponents.Count
> Sheets.Add After:=Sheets(ModuleCount)

All the replies so far have explained how to turn it back on, but why
are you using it anyway? If you want to add a sheet at the end, use:

ActiveWorkbook.Sheets.Add After:=ActiveWorkbook.Sheets.Count

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk


0 new messages