|
Open Microsoft Word from Excel
This free macro will open the Microsoft Word program on your computer. You do need to have this program first. This will not open a specific file or Word Document but only the program itself. It can be attached to a button or checkbox or form and set to run when that item is clicked or this code can be input into an existing macro in excel.
Note:You must already have Microsoft Word on your computer for this macro to work.
Where to install the macro: Module
Open Microsoft Word from Excel
Sub Open_Word()
'Opens Microsoft Word from Excel
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
End Sub
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor
For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- Go to the menu at the top of the window and click Insert > Module
- Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
- Go to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Go to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
- Go to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.
Similar Helpful Excel Resources
I have a bunch of text in my worksheet. I use Alt + Enter to break lines of text within a cell, but its still alot of text in some cells, and some others are blank.
I would the formatting functionality of Word, which can change individual cell widths and heights, and even add a table into one cell. What should I do? Are there any add-ons?
Thanks-
Hi all,
Basically I need to be able to open a word document, be presented with an open dialog box, select a csv file and then use that csv file as the data source for mail merge. So far I have the following:
Code:
Private Sub Document_Open()
Const msoFileDialogOpen = 1
Set objWord = CreateObject("Word.Application")
objWord.ChangeFileOpenDirectory ("C:\")
objWord.FileDialog(msoFileDialogOpen).Title = "Select the CSV file to be merged"
objWord.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
If objWord.FileDialog(msoFileDialogOpen).Show = -1 Then
objWord.WindowState = 2
End If
End Sub
And that's as far as I am, I need to add a filter as well so the user can only select CSV files. Pulling the file name back out is causing me a lot of problems when it shouldn't really be too difficult! Please any help would be greatly appreciated.
Hi Excel Experts,
Is there a macro that can open a Microsoft Word document? I've had a look through the forum, but cannot see what I am after.
Any help is appreciated.
Cheers
I'm trying to import Microsoft Word files into 2003 Microsoft Excel, and am
unable to do so.
Hi,
I'm not sure if there is a better forum for this but I have a question about updating a report typed in word with values in an Excel Spreadsheet. I have a workbook that I use often and then I need to write a standard report that uses values from the changing workbook.
I would like to know if there is a way to create tags in the word document and then somehow write some code that would change the tags to the correct information.
Quote:
The man lived in a house in .
The example here is very brief and I would have multiple tags to update. Any help would be greatly appreciated.
Thanks in advance.
I was trying to find a way to copy content from MS word table to MS excel. The problem I'm having is when I cut and paste a contents from a table, every row (with multiple lines) from word is treated as single row in excel. Is it possible it gets pasted in same row.
for example:
I have a table in Word with 4 columns and two of the columns have content with multiple lines (may be 10 lines)..when I cut and paste the table on excel, the 10 lines are treated as 10 rows.
Greatly appreciate if anyone has any ideas or formula that I can use to tackle this situation.
Thanks,
dbacks
I need to program a command button on a user form to open microsoft word. Could someone please let me know how to do this? Thanks.
Hello, I am writing this code to open and print a Microsoft Word Document from Excel Visual Basic. I can open and print if I have the exact filename (Doc1.doc). However I will be changing the filename version a lot so I needed to make it recognize Doc*.doc. When I ran the code, I would get
'Run time error 5151
Word was unable to read this document. It may be corrupt
Try one or more of the following:
*Open and repair the file
*Open the file with Text Recovery converter'
This is the code I used
Dim wdApp As Object
Dim wdDoc As Object
Set wdApp = CreateObject("Word.application")
Set wdDoc = wdApp.Documents.Open("S:\Doc*.doc") -works if I changed from Doc*.doc to Doc1.doc
wdApp.Visible = True
Set wdDoc = Nothing
Set wdApp = Nothing
Today a company e-mailed me a quotation with the extension: xls
I don't have Excel and eventually found Excel Viewer 2003. This took 45 mins
to download, and then didn't work. The Excel File Graphic had appeared atop
the quotation file - but when clicked on Excel Viewer 2003 opened and just
said: cannot open this file type.
Any ideas? Would appreciate solution. Running XP SP2 on a Dimension 8250..
Thanks
Hi Everyone,
This is really straight-forward. Are there any Microsoft Word forums that you know of that has as an active community as these boards does? People here are posting and answering questions constantly. I have not found a board for Word that people are as involved in. Normally find posts from weeks or months ago.
In here, if I post a question, then I receive responses really quick, normally.
Thanks,
Chris
|
|