Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Changeing codename of worksheet via VBComponents collection

I wrote an add-in for Excel-2000 containing the following code

Dim wks As Worksheet

For Each wks In TheWorkbook.Worksheets
If (wks.Index 1) And (wks.Index < TheWorkbook.Worksheets.Count) Then

TheWorkbook.VBProject.VBComponents(wks.CodeName).P roperties("_CodeName") = _
"U" & wks.Index
End If
Next wks

This used to work. We have switched to Windows XP and Office 2003 (Small
business ed. SP2), and now I get an error (#1004), which reads (translated
from dutch): "Access to Visual Basic project at programming level
unreliable". Is it correct that access to this 'back door' to change the
worksheet code name has been changed in the transition to Excel 2003? Is
there a way to achieve the name change in another way?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Changeing codename of worksheet via VBComponents collection

Excel 2002 has a new macro security that you need to "approve" to perform
VBA manipulation of VBProject objects.

To set this,
choose Tools/Macro/Security from the Excel menu,
select the Trusted Sources tab
put a check in the checkbox called "Trust Access to Visual Basic Project".


--
HTH

Bob Phillips

"Arne" wrote in message
...
I wrote an add-in for Excel-2000 containing the following code

Dim wks As Worksheet

For Each wks In TheWorkbook.Worksheets
If (wks.Index 1) And (wks.Index < TheWorkbook.Worksheets.Count)

Then

TheWorkbook.VBProject.VBComponents(wks.CodeName).P roperties("_CodeName") =

_
"U" & wks.Index
End If
Next wks

This used to work. We have switched to Windows XP and Office 2003 (Small
business ed. SP2), and now I get an error (#1004), which reads (translated
from dutch): "Access to Visual Basic project at programming level
unreliable". Is it correct that access to this 'back door' to change the
worksheet code name has been changed in the transition to Excel 2003? Is
there a way to achieve the name change in another way?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Changeing codename of worksheet via VBComponents collection

Aha, I see. Clearly, 'unreliable' was the wrong translation, as it has to do
with trustworthiness. Anyway, this solves the problem. Thank you very much!

"Bob Phillips" wrote:

Excel 2002 has a new macro security that you need to "approve" to perform
VBA manipulation of VBProject objects.

To set this,
choose Tools/Macro/Security from the Excel menu,
select the Trusted Sources tab
put a check in the checkbox called "Trust Access to Visual Basic Project".


--
HTH

Bob Phillips

"Arne" wrote in message
...
I wrote an add-in for Excel-2000 containing the following code

Dim wks As Worksheet

For Each wks In TheWorkbook.Worksheets
If (wks.Index 1) And (wks.Index < TheWorkbook.Worksheets.Count)

Then

TheWorkbook.VBProject.VBComponents(wks.CodeName).P roperties("_CodeName") =

_
"U" & wks.Index
End If
Next wks

This used to work. We have switched to Windows XP and Office 2003 (Small
business ed. SP2), and now I get an error (#1004), which reads (translated
from dutch): "Access to Visual Basic project at programming level
unreliable". Is it correct that access to this 'back door' to change the
worksheet code name has been changed in the transition to Excel 2003? Is
there a way to achieve the name change in another way?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Changeing codename of worksheet via VBComponents collection


"Arne" wrote in message
...
Aha, I see. Clearly, 'unreliable' was the wrong translation, as it has to

do
with trustworthiness. Anyway, this solves the problem. Thank you very

much!

<g. The actual English text is Programmatic Access to Visual Basic project
is Not Trusted.


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
Changeing cell size in the middle of a worksheet JS Excel Worksheet Functions 1 April 27th 05 03:22 PM
Referencing worksheet CODENAME in a chart object. Bing Excel Discussion (Misc queries) 1 February 15th 05 01:01 AM
Referencing worksheet CODENAME in a chart object. Bing Excel Programming 2 February 14th 05 07:08 PM
Using Worksheet Codename to Determine Worksheet Existence David Copp[_3_] Excel Programming 4 July 2nd 04 08:00 AM
Worksheet codename Andy Excel Programming 4 December 2nd 03 04:12 PM


All times are GMT +1. The time now is 10:22 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"