Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loops are Great as long as they work


Hello people, Is anyone good at looping through workbooks? - im not,

I can perform a simple loop like this;

Dim wb As Workbook
Dim wbs As Workbooks

Set wbs = Application.Workbooks

For Each wb In wbs
MsgBox wb.Name
Next wb

The problem is when I replace the msgbox code with my macro it doesnt
work, or rather the problem is it works on the visible workbook then
fails to loop to any other workbooks.

I know this because my code has some handling error code that gives a
warning if you try and run the macro more than once on the same sheet.

Interestingly, If I have three workbooks open the error messgae will
appear twice indicating that VBA knows how many workbooks are open even
though it doesnt loop through them -

HELP very much appreciated - entire wont fit on here (although most of
it will be irrelevant to problem

Cheers - Greg


--
Turin
------------------------------------------------------------------------
Turin's Profile: http://www.excelforum.com/member.php...o&userid=24987
View this thread: http://www.excelforum.com/showthread...hreadid=466535

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Loops are Great as long as they work

Hi Greg.

Please post your contentious code.


---
Regards,
Norman



"Turin" wrote in
message ...

Hello people, Is anyone good at looping through workbooks? - im not,

I can perform a simple loop like this;

Dim wb As Workbook
Dim wbs As Workbooks

Set wbs = Application.Workbooks

For Each wb In wbs
MsgBox wb.Name
Next wb

The problem is when I replace the msgbox code with my macro it doesnt
work, or rather the problem is it works on the visible workbook then
fails to loop to any other workbooks.

I know this because my code has some handling error code that gives a
warning if you try and run the macro more than once on the same sheet.

Interestingly, If I have three workbooks open the error messgae will
appear twice indicating that VBA knows how many workbooks are open even
though it doesnt loop through them -

HELP very much appreciated - entire wont fit on here (although most of
it will be irrelevant to problem

Cheers - Greg


--
Turin
------------------------------------------------------------------------
Turin's Profile:
http://www.excelforum.com/member.php...o&userid=24987
View this thread: http://www.excelforum.com/showthread...hreadid=466535



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loops are Great as long as they work


Hope this helps - thanks for the reply

Had to send it as an attachment - dont know whether it will work,

Let me know what you think....


Thanks again


+-------------------------------------------------------------------+
|Filename: wkbook loop code.doc |
|Download: http://www.excelforum.com/attachment.php?postid=3805 |
+-------------------------------------------------------------------+

--
Turin
------------------------------------------------------------------------
Turin's Profile: http://www.excelforum.com/member.php...o&userid=24987
View this thread: http://www.excelforum.com/showthread...hreadid=466535

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Loops are Great as long as they work

Hi Turin,

Just copy / paste the code.

With good reason, few in this group would be prepared to open attachments.
Therefore, if you post the code, you will significantly improve the
probability of effective assistance.

---
Regards,
Norman



"Turin" wrote in
message ...

Hope this helps - thanks for the reply

Had to send it as an attachment - dont know whether it will work,

Let me know what you think....


Thanks again


+-------------------------------------------------------------------+
|Filename: wkbook loop code.doc |
|Download: http://www.excelforum.com/attachment.php?postid=3805 |
+-------------------------------------------------------------------+

--
Turin
------------------------------------------------------------------------
Turin's Profile:
http://www.excelforum.com/member.php...o&userid=24987
View this thread: http://www.excelforum.com/showthread...hreadid=466535



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loops are Great as long as they work


Sorry,

I tried to post the code but the forum says it is too big to fit o
here.
Not sure I can trim it down either as this may remove the isuue that i
causing the problem to the loop?????

For what is worth, I can gurantee that the attachment is not dodgy, i
is just a .doc file.

Other than the attachment dont see how I can actually get it too you i
its entirety.

Could the problem be a general one? for example, could the code caus
problems to the loop as it uses multiple loops and if statements
Something like that?
I otherwords is there anything that a wkbook loop doesnt like t
occur???

Regards Gre

--
Turi
-----------------------------------------------------------------------
Turin's Profile: http://www.excelforum.com/member.php...fo&userid=2498
View this thread: http://www.excelforum.com/showthread.php?threadid=46653

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
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
Long Long Long Nested If Function sed Excel Discussion (Misc queries) 4 December 9th 09 06:44 PM
THIS IS A GREAT SITE! THANK YOU!!!! Excel User Excel Discussion (Misc queries) 1 August 8th 05 06:38 PM
why won't vlookup work in a long list pkeegs Excel Worksheet Functions 9 August 2nd 05 02:28 PM
Great discovery? David Excel Worksheet Functions 0 May 12th 05 08:25 AM


All times are GMT +1. The time now is 08:19 AM.

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

About Us

"It's about Microsoft Excel"