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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open an Excel file using Word VB Editor

Status
Not open for further replies.

Krispy2293

Technical User
Jan 13, 2003
4
0
0
US
I am trying to open a certain Excel file using VB editor in Word. I have used the Shell function to open Excel, but am having trouble opening the spreadsheet. Does anyone know how to do this?

Thanks!
 
Why not go for the good ol' automation way:

Dim l_objXL as Excel.Application
Dim l_wkbToOpen as workbook


Set objXL = CreateObject("Excel.Application")
l_objXL .Visible = True
Set l_wkbToOpen = l_objXL .Workbooks.Open ("C:\Path\File.xls")

'<code to do stuff with the xl file, if needed>

'Close workbook
l_wkbToOpen.Close

'Release objects
Set l_wkbToOpen = Nothing
et l_objXL = Nothing


HTH

Cheers
Nikki ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top