There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop mac malware motherboard mouse network networking outlook 2007 popups power printer problem ram router screen slow sound trojan usb virus vista vista 32-bit windows windows xp winxp wireless wmp
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
visual basic and excel spreedsheets


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
douggerlach's Avatar
Junior Member with 17 posts.
 
Join Date: May 2004
Experience: Intermediate
22-Jun-2004, 05:34 PM #1
visual basic and excel spreedsheets
hello,
i am using vb 6 to write an app that opens multiple excel spreedsheets and pull data from those spreedsheets. I need to know the code line for switching between the multiple workbooks and pages once they are all opened.

can anyone help with this?
thanks
doug
B3gbie's Avatar
Senior Member with 242 posts.
 
Join Date: Nov 2001
Location: Banoldswick, England
24-Jun-2004, 05:13 PM #2
Why not do this within Excel using VBA? The functionality is slightly reduced as far as VB is concerned, but you already have all the Excel functions at hand in the object browser.
Kelly_in_LA's Avatar
Member with 47 posts.
 
Join Date: Jun 2004
Location: Los Angeles, California
Experience: Intermediate
27-Jun-2004, 07:49 PM #3
Is something like this what you are looking for?


Windows("Book1").Activate
Windows("Book2").Activate
Sheets("Sheet2").Select


Also, you do not need to activate a particular workbook in order to obtain information from or about it. You can call on that workbook and its properties and methods without activating the workbook.

For example, if "Book1" is the active (visible, "on top") workbook, then something like:

MsgBox Workbooks("Book2").Worksheets("Sheet1").Cells(1, 1)

...will still work just fine even though "Book2" is not the active workbook.


Hope that helps!
-Kelly

http://kellyjones.netfirms.com/dictionary.html
Kelly_in_LA's Avatar
Member with 47 posts.
 
Join Date: Jun 2004
Location: Los Angeles, California
Experience: Intermediate
27-Jun-2004, 07:52 PM #4
Of course, from VB6, I believe you have to add "Excel" to everything, such as:

Excel.Windows("Book1").Activate
Excel.Windows("Book2").Activate
Excel.Sheets("Sheet2").Select

Am I right about that? I'm not the leading expert on VB6 by any means. But I definitely know VBA for Excel.

Perhaps someone can clarify whether:

Excel.Windows("Book1").Activate

is appropriate and correct for what you are asking.

Best of luck!
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:26 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.