MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Open Excel document from within Word


Posted by J-P on November 15, 2001 10:29 AM

How can I use the Open feature from within a Word document, double click an excel spreadsheet, and have it automatically open in a new window in Excel (i.e. NOT try to convert the file and open in Word)


Posted by faster on November 15, 2001 11:49 AM

this may help you
just rename MyFile to the file you want to open
it works in Word 2000

Sub OpenExcelFile()
Dim Chan
Dim MyFile
MyFile = "C:\MyFolder\FILE_NAME_HERE.xls"

Chan = DDEInitiate(App:="Excel", Topic:="System")

DDEExecute Channel:=Chan, Command:="[OPEN(" & Chr(34) _
& MyFile & Chr(34) & ")]"

DDETerminate Channel:=Chan

End Sub

Posted by Ian Mac on November 16, 2001 2:53 AM

Create a Hyperlink to the file in Word (NT)

Posted by J-P on November 16, 2001 5:22 AM

DDEExecute Channel:=Chan, Command:="[OPEN(" & Chr(34) _ & MyFile & Chr(34) & ")]"

Where should I put this code? Looks like this is exactly what I'm looking for, but I'm not sure what file to add this to or create a new file and put it in a certain directory. Also, do you know of a way to make this rule apply to ALL excel files?