Forum Home
Press F1
 
Thread ID: 18776 2002-05-02 03:07:00 Calling Excel from VB Guest (0) Press F1
Post ID Timestamp Content User
46747 2002-05-02 03:07:00 Hi there,
I have a VB program that call Excel and loads some csv files in it.
When processing a second file I'd like to detect that Excell is already running and locate the exact sheet I need in the workbook being used by Excel (this is available as a private variable). All the examples on the web refer to CreateObject and GetObject but I have found no examples that refer to specific sheets, only examples that can open an existing *.xls file (workbook).
Any suggestion to 'HOW TO' directories is welcome.

Thank you all,

Marco
Guest (0)
46748 2002-05-02 04:33:00 I usually do this sort of thing the other way round - ie have an Excel Macro pass stuff to another app.

eg.
AppActivate App_Name, False ' go back to Application to pick up data - App_Name should be string or Variant containing the First part of the App_name as you would see it in the Dark blue title bar of its window. Typically for Excel this is 'Microsoft Excel -'

Workbooks(Book_Name).Activate ' tell Excel which book to open - may not be required if you only have one or can guarantee the one you want is currently active.

Worksheets(Sheet_Name).Activate ' Sheet_Name is String or Variant (can also use a number which is the tab order number. 1 is left most)

That should now have you point at the right sheet.

have fun
Guest (0)
1