Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening excel document from word

Status
Not open for further replies.

moontho

Technical User
Jun 4, 2003
85
GB
I'm opening a series of excel files using the code below

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWB = xlApp.Workbooks.Open("L:\Shared\CCFP\FACTS&BR\Offwork.xls")
Set xlWB = xlApp.Workbooks.Open("L:\Shared\CCFP\FACTS&BR\Onwork.xls")
Set xlWB = xlApp.Workbooks.Open("L:\Shared\CCFP\FACTS&BR\Chartswork.xls")

Is there a way i can have the code check if the files are already open? and if they are to only open the above that are not already open?

Many thanks

Thom
 
Dim wkb As Workbook

For Each wkb In xlApp.Workbooks
Debug.Print wkb.Name, etc
Next wkb

Use the above as a shell to get what you need. Good Luck!

Have a great day!

j2consulting@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top