Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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.
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
Method "Method 'Open' of object 'Workbooks' failed [email protected] Excel Programming 2 June 2nd 10 05:28 PM
Method ‘Add’ of object ‘CommandbarControls’ failed sgltaylor Excel Programming 1 August 22nd 08 02:31 AM
Urgent help Runtime error ‘1004’ Method ‘SaveAs’ of object’-Workbook’ failed ????? funkymonkUK[_155_] Excel Programming 4 May 4th 06 12:56 PM
method vbproject of object workbook fail Chrispy[_2_] Excel Programming 4 January 9th 04 06:56 AM
Method ~ of Object ~ Failed. Joan Excel Programming 5 August 26th 03 08:13 PM


All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"