ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   To open workbooks: how to put behind wbk in front? (https://www.excelbanter.com/excel-programming/429849-open-workbooks-how-put-behind-wbk-front.html)

fred

To open workbooks: how to put behind wbk in front?
 
Hello,
My app opens 2 workbooks using Excel automation.
The second wrkbook is displayed in front.
How to put the first wrkbook in front?
Thanks,
Fred



fred

To open workbooks: how to put behind wbk in front?
 
That can be the problem.
If the workbook is already opened before my app starts I will not know its
name.
Thanks,
Fred

"Dave Peterson" wrote in message
...
If you know the name of the workbook being opened:
Workbooks("book999.xls").activate


fred wrote:

Hello,
My app opens 2 workbooks using Excel automation.
The second wrkbook is displayed in front.
How to put the first wrkbook in front?
Thanks,
Fred


--

Dave Peterson




Jacob Skaria

To open workbooks: how to put behind wbk in front?
 
Fred, it is always better to refer the workbook when you open..

Dim wbBook1 As Workbook
Dim wbBook2 As Workbook

Set wbBook1 = Workbooks.Open("<fullpath\<filename.ext")
Set wbBook2 = Workbooks.Open("<fullpath\<filename.ext")

wbBook1.Activate

If this post helps click Yes
---------------
Jacob Skaria


"fred" wrote:

Hello,
My app opens 2 workbooks using Excel automation.
The second wrkbook is displayed in front.
How to put the first wrkbook in front?
Thanks,
Fred




DocBrown

To open workbooks: how to put behind wbk in front?
 
I do this:

Dim wbFirstName as string

' do stuff that opens the first workbook

wbFirstName = Activeworkbook.name

' your code here that opens second workbook

Workbooks(wbFirstName).activate


"Jacob Skaria" wrote:

Fred, it is always better to refer the workbook when you open..

Dim wbBook1 As Workbook
Dim wbBook2 As Workbook

Set wbBook1 = Workbooks.Open("<fullpath\<filename.ext")
Set wbBook2 = Workbooks.Open("<fullpath\<filename.ext")

wbBook1.Activate

If this post helps click Yes
---------------
Jacob Skaria


"fred" wrote:

Hello,
My app opens 2 workbooks using Excel automation.
The second wrkbook is displayed in front.
How to put the first wrkbook in front?
Thanks,
Fred





All times are GMT +1. The time now is 08:46 AM.

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