+ Reply to Thread
Results 1 to 4 of 4

Changeing codename of worksheet via VBComponents collection

  1. #1
    Arne
    Guest

    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).Properties("_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. #2
    Bob Phillips
    Guest

    Re: 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" <Arne@discussions.microsoft.com> wrote in message
    news:9CB1088E-900A-45CA-8E31-505EDCF89F00@microsoft.com...
    > 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).Properties("_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. #3
    Arne
    Guest

    Re: 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" <Arne@discussions.microsoft.com> wrote in message
    > news:9CB1088E-900A-45CA-8E31-505EDCF89F00@microsoft.com...
    > > 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).Properties("_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. #4
    Bob Phillips
    Guest

    Re: Changeing codename of worksheet via VBComponents collection


    "Arne" <Arne@discussions.microsoft.com> wrote in message
    news:7671ADF3-D5B2-4F8C-9F10-00DDAB4760A0@microsoft.com...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1