ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro one workbook to another (https://www.excelbanter.com/excel-programming/322085-macro-one-workbook-another.html)

MESTRELLA29[_2_]

Macro one workbook to another
 
I have the following Macro that is a Journal Entry, when I run the macro it
opens a template and copies information from the active workbook to the
template, what I need is to run in base of the current active workbook and
not "2004 JE Worksheets NEW.xls").Activate, because this forces me to name
the file always the same way.

Let me know if i did not make myself clear

Workbooks.Add Template:= _
"C:\Documents and Settings\mestrell.000\Application
Data\Microsoft\Templates\JE BPCS upload.xlt"
Windows("2004 JE Worksheets NEW.xls").Activate



Robin Hammond[_2_]

Macro one workbook to another
 
Are you looking for something like this?

Dim wSource as Workbook
Set wSource = ActiveWorkbook

Workbooks.Add Template:= _
"C:\Documents and
Settings\mestrell.000\ApplicationData\Microsoft\Te mplates\JE BPCS
upload.xlt"

wSouce.Activate

'carry on from here

Robin Hammond
www.enhanceddatasystems.com

"MESTRELLA29" wrote in message
...
I have the following Macro that is a Journal Entry, when I run the macro it
opens a template and copies information from the active workbook to the
template, what I need is to run in base of the current active workbook and
not "2004 JE Worksheets NEW.xls").Activate, because this forces me to name
the file always the same way.

Let me know if i did not make myself clear

Workbooks.Add Template:= _
"C:\Documents and Settings\mestrell.000\Application
Data\Microsoft\Templates\JE BPCS upload.xlt"
Windows("2004 JE Worksheets NEW.xls").Activate





MESTRELLA29[_2_]

Macro one workbook to another
 
YES !!!!!!

That is IT.... THANKS FOR ALL YOUR HELP...

"Robin Hammond" wrote:

Are you looking for something like this?

Dim wSource as Workbook
Set wSource = ActiveWorkbook

Workbooks.Add Template:= _
"C:\Documents and
Settings\mestrell.000\ApplicationData\Microsoft\Te mplates\JE BPCS
upload.xlt"

wSouce.Activate

'carry on from here

Robin Hammond
www.enhanceddatasystems.com

"MESTRELLA29" wrote in message
...
I have the following Macro that is a Journal Entry, when I run the macro it
opens a template and copies information from the active workbook to the
template, what I need is to run in base of the current active workbook and
not "2004 JE Worksheets NEW.xls").Activate, because this forces me to name
the file always the same way.

Let me know if i did not make myself clear

Workbooks.Add Template:= _
"C:\Documents and Settings\mestrell.000\Application
Data\Microsoft\Templates\JE BPCS upload.xlt"
Windows("2004 JE Worksheets NEW.xls").Activate







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

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