ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ThisWorkBook problem (https://www.excelbanter.com/excel-programming/359787-thisworkbook-problem.html)

Blogd_Node

ThisWorkBook problem
 
Hi,

Just starting coding VB in Excel.
Am more familiar with Access, so I know
just enough VB to be dangerous to myself...
:-)

I have a macro (in PERSONAL.XLS) which is run from within TEST.XLS.

In the line of code
set basebook = thisworkbook

"ThisWorkbook" refers to personal.xls and NOT test.xls.

How do I refer to the TEST.XLS ?

Many thanks

David



Andrew B[_5_]

ThisWorkBook problem
 
Hi

Try

set basebook = Active.Workbook

Regards

Andrew b


Blogd_Node wrote:


Hi,

Just starting coding VB in Excel.
Am more familiar with Access, so I know
just enough VB to be dangerous to myself...
:-)

I have a macro (in PERSONAL.XLS) which is run from within TEST.XLS.

In the line of code
set basebook = thisworkbook

"ThisWorkbook" refers to personal.xls and NOT test.xls.

How do I refer to the TEST.XLS ?

Many thanks

David



Tom Ogilvy

ThisWorkBook problem
 
set basebook = Workbooks("Test.xls")

if it isn't always test.xls but it will be the active workbook

set basebook = ActiveWorkbook

--
Regards,
Tom Ogilvy


"Blogd_Node" wrote in message
u...
Hi,

Just starting coding VB in Excel.
Am more familiar with Access, so I know
just enough VB to be dangerous to myself...
:-)

I have a macro (in PERSONAL.XLS) which is run from within TEST.XLS.

In the line of code
set basebook = thisworkbook

"ThisWorkbook" refers to personal.xls and NOT test.xls.

How do I refer to the TEST.XLS ?

Many thanks

David





Blogd_Node

ThisWorkBook problem
 
Thanks Tom / Andrew.

Works fine now! Much appreciated !

===============================
"Tom Ogilvy" wrote in message ..
set basebook = Workbooks("Test.xls")

if it isn't always test.xls but it will be the active workbook

set basebook = ActiveWorkbook


"Blogd_Node" wrote in message


Hi,

Just starting coding VB in Excel.
Am more familiar with Access, so I know
just enough VB to be dangerous to myself...
:-)

I have a macro (in PERSONAL.XLS) which is run from within TEST.XLS.

In the line of code
set basebook = thisworkbook

"ThisWorkbook" refers to personal.xls and NOT test.xls.

How do I refer to the TEST.XLS ?





All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com