Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Pass Workbook Name Into Another Workbook As A Variable

Greetings,

I open one workbook which opens another workbook using the workbook
open event of the first workbook. The first workbook is the active
workbook. The first workbook's name is not always the same but it's
code is.

Is there a way that the name of the first workbook or a variable with
that name assigned to it, be used in the second workbook's code?

I tried ThisWorkbook but could not get it to work.

Any help would be greatly appreciated.

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Pass Workbook Name Into Another Workbook As A Variable

Hi!

"ThisWorkbook" property refers to the workbook who contains the code.

Use the "ActiveWorkbook" property.

John


Ο χρήστης "Minitman" *γγραψε:

Greetings,

I open one workbook which opens another workbook using the workbook
open event of the first workbook. The first workbook is the active
workbook. The first workbook's name is not always the same but it's
code is.

Is there a way that the name of the first workbook or a variable with
that name assigned to it, be used in the second workbook's code?

I tried ThisWorkbook but could not get it to work.

Any help would be greatly appreciated.

-Minitman

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Pass Workbook Name Into Another Workbook As A Variable

Hi J_J, I am not so sure the OP can use ActiveWorkbook to refer back to the
opening workbook. If the code is running in wb 2 then wb 2 is the active
workbook.
A crude but effective way is to store the wb 1 name in a cell of a specific
sheet and then call that cell from wb 2 macro.

"John_John" wrote:

Hi!

"ThisWorkbook" property refers to the workbook who contains the code.

Use the "ActiveWorkbook" property.

John


Ο χρήστης "Minitman" *γγραψε:

Greetings,

I open one workbook which opens another workbook using the workbook
open event of the first workbook. The first workbook is the active
workbook. The first workbook's name is not always the same but it's
code is.

Is there a way that the name of the first workbook or a variable with
that name assigned to it, be used in the second workbook's code?

I tried ThisWorkbook but could not get it to work.

Any help would be greatly appreciated.

-Minitman

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Pass Workbook Name Into Another Workbook As A Variable

Hey John,

Thanks for the reply.

Good call. That seems to do the job if I make the first workbook
active before I start the code

Thanks.

-Minitman
(My company is called Minit Maids of Austin which makes me the
Minitman) :^


On Wed, 10 Sep 2008 16:43:01 -0700, John_John
wrote:

Hi!

"ThisWorkbook" property refers to the workbook who contains the code.

Use the "ActiveWorkbook" property.

John


? ??????? "Minitman" ???????:

Greetings,

I open one workbook which opens another workbook using the workbook
open event of the first workbook. The first workbook is the active
workbook. The first workbook's name is not always the same but it's
code is.

Is there a way that the name of the first workbook or a variable with
that name assigned to it, be used in the second workbook's code?

I tried ThisWorkbook but could not get it to work.

Any help would be greatly appreciated.

-Minitman


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Pass Workbook Name Into Another Workbook As A Variable

Check out Chip Pearson's site for more info on variables between workbooks.

http://www.cpearson.com/excel/TrulyGlobalVariables.htm

"Minitman" wrote:

Greetings,

I open one workbook which opens another workbook using the workbook
open event of the first workbook. The first workbook is the active
workbook. The first workbook's name is not always the same but it's
code is.

Is there a way that the name of the first workbook or a variable with
that name assigned to it, be used in the second workbook's code?

I tried ThisWorkbook but could not get it to work.

Any help would be greatly appreciated.

-Minitman



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
pass variable from one workbook to another calebjill Excel Discussion (Misc queries) 2 January 28th 09 07:38 PM
Pass ActiveCell Value to my Add In Workbook RyanH Excel Programming 1 September 3rd 08 09:36 AM
Pass workbook name to ActiveX DLL meldrum_scotland Excel Programming 2 August 9th 08 11:03 PM
How to pass variable between closed workbook hon123456 Excel Programming 0 June 13th 06 10:20 AM
pass workbook name to sub Przemek Excel Programming 1 August 11th 05 04:09 PM


All times are GMT +1. The time now is 01:37 AM.

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

About Us

"It's about Microsoft Excel"