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

F

fred

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
 
F

fred

That can be the problem.
If the workbook is already opened before my app starts I will not know its
name.
Thanks,
Fred
 
J

Jacob Skaria

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
 
D

DocBrown

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
 
Top