LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Odp: EX2007 - Error 1004: method 'VBProject' of object '_Workbook' failed

on 9/1/2011, aditel supposed :
Hi Garry,

thank you for your comments.
I will start with results of my checks and observations from your second
post. Unfortunatelly it is not enough to simly loop through the sheets of
another workbook, especially when it is opened from network folder. In such
cases CodeName is 'Empty'. That's why I decided to get to VBComponents via
VBProject.


I don't know what/how you're doing this but the worksheet loop code I
gave you ALWAYS returns the codename because ALL worksheets MUST HAVE A
CODENAME! Thus, CodeName will NEVER be 'Empty'! This works for ALL open
workbooks regardless of where they're stored/opened from.

CodeName is used by many developers to assign design time names to
multi-sheet projects/templates so a ref in our code can be acquired to
the needed sheet in case users rename their tabs. This is a reliable
methodology BECAUSE every sheet ALWAYS has a codename.

And now going to first post...
I changed data type to Variant and it worked! However when I saved project
and restarted Excel application it stopped working again. After several tries
it seems that it is not even necessary to change data type to Variant but
just open VBA editor and run the code. When you do this without opening VBA
in new Excel session it does not work.

I really have no idea how to solve this issue.


I ran YOUR code AS IS and VBA halted, highlighting the line 'dim
mybookProject As VBIDE.VBProject and stated 'User-defined type not
defined'. Changing VBC to Variant AND dropping mybookProject worked as
exampled.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




 
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
Run-time error 1004 Method SaveAS of object _Workbook failed David Excel Programming 2 December 18th 08 08:38 PM
method 'SaveAs' of object '_Workbook' failed Kishi Excel Programming 1 July 12th 06 03:51 AM
Method 'CheckIn' of object '_workbook' failed Bill Schanks Excel Programming 1 May 9th 06 10:04 PM
Error 1004 Method 'Add'of Object Sheets failed ExcelMonkey[_190_] Excel Programming 10 March 29th 05 01:52 PM
Error 1004: Method 'Cells' of object '_Global' failed LT Excel Programming 2 October 31st 03 04:47 PM


All times are GMT +1. The time now is 07:19 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"