Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default What workbook is calling the function

I wrote a function that resides in an addin.

In the function I need to know what workbook is calling the function. It's
not the ActiveWorkbook, as the function may be called from a Workbook that
is dependant on the calling Workbook.

So the question is how do I determine the workbook that is calling the
function ?

Tks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default What workbook is calling the function

dim wb as workbook

if typename(application.caller)="Range" then
set wb= application.caller.parent.parent
end if

sould do it :)


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Pierre Laporte" wrote:

I wrote a function that resides in an addin.

In the function I need to know what workbook is calling the function.
It's not the ActiveWorkbook, as the function may be called from a
Workbook that is dependant on the calling Workbook.

So the question is how do I determine the workbook that is calling the
function ?

Tks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default What workbook is calling the function

Works great, thanks keepITcool.

"keepITcool" wrote in message
...
dim wb as workbook

if typename(application.caller)="Range" then
set wb= application.caller.parent.parent
end if

sould do it :)


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Pierre Laporte" wrote:

I wrote a function that resides in an addin.

In the function I need to know what workbook is calling the function.
It's not the ActiveWorkbook, as the function may be called from a
Workbook that is dependant on the calling Workbook.

So the question is how do I determine the workbook that is calling the
function ?

Tks






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
INDIRECT() calling a separate workbook smaruzzi Excel Discussion (Misc queries) 1 December 25th 08 04:32 PM
Calling macros in another workbook Nick Wright Excel Worksheet Functions 1 January 12th 06 04:03 PM
Calling another workbook not working malik641 Excel Worksheet Functions 2 June 24th 05 07:36 PM
calling sub from another workbook James[_9_] Excel Programming 1 October 14th 03 06:06 PM
Calling macros from another XL Workbook jamesa Excel Programming 1 October 2nd 03 03:06 PM


All times are GMT +1. The time now is 07:48 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"