Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default How does a macro access its OWN workbook?

How does a macro access its OWN workbook (the workbook where the macro is defined), even when this is not the active workbook
I want to create a read-only 'reference' workbook that contains a collection of macros and a couple of worksheets with reference data. The various reference worksheets will have fixed names, but I want to avoid using a fixed name for the reference workbook
My users will select some cells in a work-in-progress workbook and then invoke one of the macros (they will have the reference workbook open at the same time). The macros will need to access the currently selected cells as well as the reference data.

Any help appreciate
Maria
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default How does a macro access its OWN workbook?

you need to use the Thisworkbook to refer to the workbook where the macro is
located. and Activeworkbook where the macro is working on.


Cesar


"Maria" wrote in message
...
How does a macro access its OWN workbook (the workbook where the macro is

defined), even when this is not the active workbook?
I want to create a read-only 'reference' workbook that contains a

collection of macros and a couple of worksheets with reference data. The
various reference worksheets will have fixed names, but I want to avoid
using a fixed name for the reference workbook.
My users will select some cells in a work-in-progress workbook and then

invoke one of the macros (they will have the reference workbook open at the
same time). The macros will need to access the currently selected cells as
well as the reference data.

Any help appreciated
Maria



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default How does a macro access its OWN workbook?

Maria,

when accessing the book the code is in, use:

ThisWorkbook.Sheets("index"). - and so on -

Pete.

-----Original Message-----
How does a macro access its OWN workbook (the workbook

where the macro is defined), even when this is not the
active workbook?
I want to create a read-only 'reference' workbook that

contains a collection of macros and a couple of worksheets
with reference data. The various reference worksheets will
have fixed names, but I want to avoid using a fixed name
for the reference workbook.
My users will select some cells in a work-in-progress

workbook and then invoke one of the macros (they will have
the reference workbook open at the same time). The macros
will need to access the currently selected cells as well
as the reference data.

Any help appreciated
Maria
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default How does a macro access its OWN workbook?

Thanks Cesar and Pete - much appreciated

I do search google before posting questions, but it's not always easy when you don't yet know the exact word to search for... :o)
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
saving macro from workbook to Personal Macro Workbook KrispyData Excel Discussion (Misc queries) 1 March 25th 10 05:52 PM
Call an Access macro from an Excel macro Jason W Excel Discussion (Misc queries) 1 May 1st 08 08:33 PM
link Access workbook to Excel workbook Toinett Excel Discussion (Misc queries) 1 January 31st 05 03:37 PM
Can't access to a Workbook Jordi Excel Programming 1 November 13th 03 11:41 AM
Launch Macro in Access via Macro running in Excel??? dgrant Excel Programming 1 September 24th 03 01:38 PM


All times are GMT +1. The time now is 03:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"