ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Method VBProject of object Workbook Failed (https://www.excelbanter.com/excel-programming/427533-method-vbproject-object-workbook-failed.html)

Jeffrey[_2_]

Method VBProject of object Workbook Failed
 
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
home
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
object'_Workbook'failed.
Can anyone help me get through with this. Thanks much.

Jeff


With VBComp
Select Case .Type
Case vbext_ct_Document

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

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


End If

Case Else
ActiveWorkbook.VBProject.VBComponents.Remove
VBComp
End Select
End With
Next VBComp

ericson75

Method VBProject of object Workbook Failed
 
On Apr 27, 7:49*am, Jeffrey wrote:

Hi Guys,

I got this code on this google group. and it work in my computer at
home
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
object'_Workbook'failed.
Can anyone help me get through with this. *Thanks much.


Tidying up... : )

Jeff
Dim VBComp As VBIDE.VBProject

For Each VBComp In ActiveWorkbook.VBProject.VBComponents


* * * * With VBComp
* * * * * * Select Case .Type
* * * * * * * * Case vbext_ct_Document

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

* * * * * * * * * * * * With .CodeModule
* * * * * * * * * * * * * * .DeleteLines StartLine:=1,
count:=.CountOfLines
* * * * * * * * * * * * End With

* * * * * * * * * * *End If

* * * * * * * * Case Else
* * * * * * * * * * ActiveWorkbook.VBProject.VBComponents.Remove
VBComp
* * * * * * End Select
* * * * End With
* * Next VBComp



Dave Peterson

Method VBProject of object Workbook Failed
 
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
project"

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.

Jeffrey wrote:

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
home
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
object'_Workbook'failed.
Can anyone help me get through with this. Thanks much.

Jeff

With VBComp
Select Case .Type
Case vbext_ct_Document

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

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

End If

Case Else
ActiveWorkbook.VBProject.VBComponents.Remove
VBComp
End Select
End With
Next VBComp


--

Dave Peterson

ericson75

Method VBProject of object Workbook Failed
 
On Apr 27, 9:37*am, Dave Peterson wrote:
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
project"

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.





Jeffrey wrote:

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
home
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
object'_Workbook'failed.
Can anyone help me get through with this. *Thanks much.


Jeff


* * * * With VBComp
* * * * * * Select Case .Type
* * * * * * * * Case vbext_ct_Document


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


* * * * * * * * * * * * With .CodeModule
* * * * * * * * * * * * * * .DeleteLines StartLine:=1,
count:=.CountOfLines
* * * * * * * * * * * * End With


* * * * * * * * * * *End If


* * * * * * * * Case Else
* * * * * * * * * * ActiveWorkbook.VBProject.VBComponents.Remove
VBComp
* * * * * * End Select
* * * * End With
* * Next VBComp


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Brilliant!!! Thank a lot mate. It is now working.


All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com