Open Excel files in Word

I

Ira Krakow

Paul

In general, works the same way as in Word 2000. To open an Excel file from Word2003, do the following

1) Create a macro by selecting Tools-Macro-Macros, creating a new macro. Call it ReadExcelFile, as an example

2) Add a reference to the Microsoft Excel nn.n Object Library. In the Visual Basic Editor, select Tools-References. Find the Microsoft Excel nn.n Object Library reference and check the check box

3) In the General Declarations section of your code module, paste the following
Dim objExcel As Excel.Applicatio
Dim objWRK As Excel.Workboo

4) In the macro, paste the following code, to open the file C:\testexcel.xls
On Error Resume Nex

Set objExcel = GetObject(, "Excel.Application"
If objExcel Is Nothing The
Set objExcel = New Excel.Applicatio
End I
Set objWRK = objExcel.Workbooks.Open("C:\testexcel.xls"
objExcel.Visible = Tru

5) Run the macro.

There are other techniques, such as embedding an Excel spreadsheet in Word. If that is what you have in mind, please email me ([email protected]

Hope this helps
Ir
 

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