Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I have serious problem with accessing VBProject of another Excel workbook. I need to play with VBComponents and check CodeNames of all sheets. Always when code refers to VBProject of another workbook error 1004 mentioned in subject of this post is generated. Notes: - “Trust access to the VBA project object model” is set on in Trust Center / Macro setting - reference to “Microsoft Visual Basic for Application Extensibility 5.3” is added - opened file is located in network drive Below there is part of code in VBA. Do you know what can be the reason of that problem? Private Sub Test() Dim MyFiles As Variant Dim Fnum As Byte Dim mybook As Workbook Dim mybookProject As VBIDE.VBProject Dim VBC As VBIDE.VBComponent MyFiles = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls", MultiSelect:=True) If IsArray(MyFiles) Then For Fnum = LBound(MyFiles) To UBound(MyFiles) Set mybook = Application.Workbooks.Open(MyFiles(Fnum), , True) ‘***** next line an error occurs ****** Set mybookProject = mybook.VBProject For Each VBC In mybookProject.VBComponents If VBC.Type = 100 Then ... ... Kind regards, Marcin |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run-time error 1004 Method SaveAS of object _Workbook failed | Excel Programming | |||
method 'SaveAs' of object '_Workbook' failed | Excel Programming | |||
Method 'CheckIn' of object '_workbook' failed | Excel Programming | |||
Error 1004 Method 'Add'of Object Sheets failed | Excel Programming | |||
Error 1004: Method 'Cells' of object '_Global' failed | Excel Programming |