Can Macro command to open files?

B

Berj

Hi all,
can anybody help me with this?

I need a command to add at the beginning of a macro which can be executed
when my Excel file NAMES.XLS is opening. The macro should be part of NAMES.XLS
This command should open another file named Q1.XLS

The Result: when I open NAMES.XLS, the other file, Q1.XLS must be opened
with it too. Then NAMES.XLS be the active file once again.

Thanks in advance,
Berj
 
G

Gary''s Student

Private Sub Workbook_Open()
ChDir "C:\Documents and Settings\Owner\Desktop\junk"
Workbooks.Open Filename:= _
"C:\Documents and Settings\Owner\Desktop\junk\Q1.xls"
Windows("NAMES.xls").Activate
End Sub

This goes in the NAMES.xls workbook code area.


Adjust the path to suite.
 

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