Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Open an excel file from word macro in the same path

Posted on 2006-11-20
5
Medium Priority
?
1,591 Views
Last Modified: 2008-01-09
I have two docs on a network share. Different people will see different paths to the same documents.
I need to have word open an excel doc in the same path without specifing the full path because each person will map the network share to different drives.

I know excel can use Thisworkbook.path
Is there a similar command I can use to open the excel doc from a word macro?

EDIT
I found ActiveDocument.Path in the macro help window. I don't know how to write the macro to open an excel file let alone use this ActiveDocument.Path statement.
The excel file I wish to open is called Clients.xls.

Thanks in advance for the help.
0
Comment
Question by:SpyderGST1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:YoungBonzi
ID: 17985085
Hello,

This should do it:

Workbooks.Open(ThisWorkbook.Path + "\Clients.xls")

Hope it helps!
0
 
LVL 7

Accepted Solution

by:
gbahri earned 1000 total points
ID: 17985318
Hi SpyderGST1,

You can use the following code to open excel workbook from Word macro, here is the code:


Sub OpenExcel()
   
    Dim ExcelSheet
    Set ExcelSheet = CreateObject("Excel.Application")
    ExcelSheet.Visible = True
    ExcelSheet.Workbooks.Open ActiveDocument.Path & Application.PathSeparator & "Client.xls"

End Sub

Hope, this serves your purpose,

Thanks,

GBahri
0
 

Author Comment

by:SpyderGST1
ID: 17988869
youngbonzi,
Thank you for your response but you suggestion did not work.
0
 
LVL 8

Expert Comment

by:YoungBonzi
ID: 17988937
Ohh, well glad the other way did =]
0
 
LVL 7

Expert Comment

by:gbahri
ID: 17993083
Thanks,

GBahri
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question