Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Open an Excel Workbook using word VBA

Posted on 2006-06-02
Medium Priority
Last Modified: 2012-06-27
I am currently preparing a template generator using Word VBA.

The Userform consists of option boxes and the programming behind the boxes simply tells it to open the files.  This works perfectly for Word documents.

However, whenever i give it a path relating to an excel spreadsheet it simply crashes.  I am a novice at vba!

Could someone provide a vba example of how to open a specific workbook in excel from word and make it appear in a normal excel window and visible?

I am creating quite a few template generators in the near future and this would be very helpful.

Many thanks
Question by:stuardo
1 Comment
LVL 44

Accepted Solution

bruintje earned 400 total points
ID: 16815758
Hi stuardo,

you could try something like calling this sub in the button click and change the filename to something that works for you of course

Sub OpenXlFile()
Dim xlObj As Object
Dim xlWbk As Object

  Set xlObj = CreateObject("Excel.Application")
  Set xlWbk = xlObj.Workbooks.Open("c:\temp.xls")
  xlObj.Visible = True

End Sub

share what you know, learn what you don't

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
Suggested Courses

571 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