Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2003, 10:43 PM
Registered User
 
Join Date: Nov 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display names of open workbooks in a MsgBox

What would be the code to loop through the names of all open workbooks in the current session?

I have tried this but get error msgs.

Dim wb as Workbook
Dim wbs as Workbooks

For each wb in wbs
  MsgBox (wb.Name)
Next wb



RJMcCluskey
 
Old November 11th, 2003, 05:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try this

Code:
Dim wb as Workbook
Dim wbs as Workbooks

Set wbs = Application.Workbooks

For each wb in wbs
  MsgBox wb.Name
Next wb
Your problem was that you were trying to loop through the workbooks in variable wbs before you had set it equal to anything.

HTH

Chris


There are two secrets to success in this world:
1. Never tell everything you know





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ident Open Workbooks in Multiple Excel Instances DaveTheOgre Pro VB Databases 0 November 12th, 2008 03:33 AM
MsgBox on Open JezLisle Excel VBA 1 August 17th, 2007 08:42 AM
excel workbooks.open bug smiler_00 Pro VB 6 0 May 9th, 2007 05:24 AM
Display only names starting with particular letter cookout XSLT 1 June 27th, 2006 11:23 AM
display names of the files as links europhreak Classic ASP Basics 1 February 20th, 2006 07:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.