Active Workbook

D

Dave

I ave a workbook named Prop53sj.xls with the code below in it. I am trying
to have it open Parts.xls (It does that fine). Then switch back to the
Prop53sj.xls workbook (It also does that). The problem is that I cant rename
Prop53sj.xls to a different name and I need to.


Private Sub Workbook_Open()

Workbooks.Open Filename:="parts.xls"
Workbooks("Prop53sj.xls").Worksheets("Title").Activate

End Sub


Thanks again
Dave
 
D

Dave Peterson

Since the code is in the workbook that owns worksheets("title"), you can use

ThisWorkbook.Worksheets("title").Activate

====
If you ever decide to change the .activate to .select, then you might want to
write it this way:

Private Sub Workbook_Open()

Workbooks.Open Filename:="parts.xls"
with thisworkbook
.select
.Worksheets("Title").select
end with
End Sub

(.Select is a little more touchy on how it works.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top