Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello all,
In an Access 2000 module, I have a routine that creates a new excel workbook (so its called Book1) and copies rows from Access to the Excel workbook. Then in a subroutine, I want to do some other stuff with the OPENED workbook. What would be the proper way of referencing an OPENED Excel workbook? Thanks, Brian |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When you open the new workbook you should save the workbook's name into a
variable: new_woorkbook = activeworkbook.name then you can always get to that workbook with: workbooks(new_workbook).activate please rate this post below thanx bac "BerkshireGuy" wrote: Hello all, In an Access 2000 module, I have a routine that creates a new excel workbook (so its called Book1) and copies rows from Access to the Excel workbook. Then in a subroutine, I want to do some other stuff with the OPENED workbook. What would be the proper way of referencing an OPENED Excel workbook? Thanks, Brian |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() better to use a workbook object variable. use a module level variable: dim mWkb as Excel.Workbook sub ProcA() set mWkb=workbooks.open("c:\book.xls") end sub sub ProcB() if not mWkb is nothing then mWkb.close end if end sub OR (better?) use arguments.. sub ProcC() dim wkb as Excel.Workbook set wkb=workbooks.open("c:\book.xls") call ProcD(wkb) end sub sub ProcD(wkb as Excel.Workbook) if not wkb is nothing then wkb.close end if end sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam BAC wrote : When you open the new workbook you should save the workbook's name into a variable: new_woorkbook = activeworkbook.name then you can always get to that workbook with: workbooks(new_workbook).activate please rate this post below thanx bac "BerkshireGuy" wrote: Hello all, In an Access 2000 module, I have a routine that creates a new excel workbook (so its called Book1) and copies rows from Access to the Excel workbook. Then in a subroutine, I want to do some other stuff with the OPENED workbook. What would be the proper way of referencing an OPENED Excel workbook? Thanks, Brian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Opening a workbook if not opened, going to it if already opened | Excel Programming | |||
Opening a workbook if not opened, going to it if already opened | Excel Programming | |||
Opening a workbook if not opened, going to it if already opened | Excel Programming | |||
How to see if the opened workbook is opened by another user ? | Excel Programming | |||
Sheets select method fails when workbook is opened by another workbook | Excel Programming |