Method VBProject of object Workbook Failed

Discussion in 'Microsoft Excel Programming' started by Jeffrey, Apr 26, 2009.

  1. Jeffrey

    Jeffrey Guest

    Dim VBComp As VBIDE.VBProject

    For Each VBComp In ActiveWorkbook.VBProject.VBComponents

    Hi Guys,

    I got this code on this google group. and it work in my computer at
    im using excel 2007. but here in the office im using excel 2003 and it
    doesnt work.
    im getting this " Activeworkbook.VBProject...=<Method'VbProject" of
    Can anyone help me get through with this. Thanks much.


    With VBComp
    Select Case .Type
    Case vbext_ct_Document

    If .CodeModule <> "Sheet1" And .CodeModule <>
    "Sheet2" Then

    With .CodeModule
    .DeleteLines StartLine:=1,
    End With

    End If

    Case Else
    End Select
    End With
    Next VBComp
    Jeffrey, Apr 26, 2009
    1. Advertisements

  2. Jeffrey

    ericson75 Guest

    Tidying up... : )
    ericson75, Apr 26, 2009
    1. Advertisements

  3. There is a security setting that can stop code from accessing code.

    In xl2003 menus:
    Tools|macro|security|trusted publishers tab|check "trust access to visual basic

    Since this is a security setting, it's a manual change for every user.

    It doesn't follow the workbook and you can't change it in code.
    Dave Peterson, Apr 26, 2009
  4. Jeffrey

    ericson75 Guest

    Brilliant!!! Thank a lot mate. It is now working.
    ericson75, Apr 27, 2009
  5. Jeffrey


    Jun 30, 2011
    Likes Received:
    This works for me :
    Tools|macro|security|trusted publishers tab|check "trust access to visual basic

    peacenlove, Jun 30, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.