Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 25th, 2006, 07:36 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default UserForm1.show fails if another workbook is open

If I have two excel files open and am running VBA application from one of them, when I try to do “User1.show”, it fails. I get a “Run Time error 9. Subscript out of range.”
However if I close the application I am not using at the moment the “User1.Show “ works as expected.

If I try to qualify the UserFrom1.Show with Workbook("Book1").UserFrom1.Show I get a compile error as "Sub or Function Not defined"

Any help would be appreciated,

Gary
Reply With Quote
  #2 (permalink)  
Old June 26th, 2006, 01:23 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Is there something within the initialization within the code of the form itself that might be throwing this error?
Reply With Quote
  #3 (permalink)  
Old June 26th, 2006, 06:37 PM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brian,

Thanks for writing. I have fixed the problem by simply renaming UserForm1 to something else and changing references to it. The problem resulted from two VBA applications having the same form name.

gary

Reply With Quote
  #4 (permalink)  
Old June 27th, 2006, 02:58 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

In this case, each VBA application has a project name. If you run into this again you can "fully qualify" the form names: Prj1.UserFrom1.Show, (etc.)

Glad you solved it.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Handling Non-Existing Web Files with Workbook.Open white_wulff Excel VBA 1 May 14th, 2007 03:07 PM
Excel 2003 VBA - Need to open a workbook in a fold bablhous BOOK: Excel 2003 VBA Programmer's Reference 0 December 21st, 2006 02:50 PM
Workbook Open anup.bihani Excel VBA 2 November 30th, 2006 01:05 AM
Error when open workbook gastoncs Excel VBA 2 December 21st, 2005 12:43 PM



All times are GMT -4. The time now is 03:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.