Change file ref in VBA

D

donh

Hi,

I have a large ish workbook and have created an index page to aid
navigation. I have also created additional menu items for users. One
of which is a link to the Index page. On testing I opened a new
workbook and the Index link generated an error. On checking added
Windows("test.xls").Activate to my Sub, and now users can navigate back
to the Index page from inside or outside of the workbook, which I'm
happy with.

My Sub

Sub Index()

Windows("test.xls").Activate
Sheets("Index").Select

End Sub

is kept in my test.xls workbook and the menu updated when opened and
items removed when closed.


My question is can I get VBA to check the xls file name (at present
test.xls) and change the Windows("test.xls").Activate to match if file
has been renamed.

Thanks for any help




DonH
 
B

Bob Phillips

Try uisng ThisWorkbook.Activate

--
---

HTH

Bob

(change the xxxx to gmail if mailing direct)
 

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