Macro to Open a Specific Word Document - Outlook 2007

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Is there an outlook macro that will simply open up a document. I have document that is in a folder and just want to open that document when I am in Outlook. The pathway to the document is : (C:\Users\UserName\AppData\Roaming\Microsoft\Templates\CalendarWordsDoc.docm). So is there a macro that will open it..and if so, please give me the full macro as soon as possible.:eek::eek::eek:
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Not clear what the full macro is.....can you post it using the location of my document?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
This is all you need to open a word file -

Public Sub OpenWord()
Dim oWord As Word.Application
Set oWord = CreateObject("Word.Application")
oWord.Documents.Add Template:="C:\Invoices\template.dotm"
With oWord
.Visible = True
End With
Set oWord = Nothing

End Sub
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Since my document is not a template....should save it as a template?....and then the "C:\Invoices\template.dotm" i replace with "C:\Users\UserName\AppData\Roaming\Microsoft\Templates\CalendarWordsDoc.dotm). Or if not a template and just a .docm, do I change the words Add Template to something else?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It really depends on what you are doing with it. I would use a template if its something you are reusing - like to send letters to clients. If its a file, like a log or diary then opening a document is ok.

if you are using it like a template, you need to use Save as or the original will be overwritten.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Thanks ...but the word document I am opening thru the code related to it, it does certain things but is not saved......so what do I change to open the document: CalendarWordsDoc.docm??
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
use Documents.Open:

oWord.Documents.Open ("C:\Invoices\template.dotm")
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I did the following and it opens up the document....but it also opens up another folder called Documents......why is it opening a folder? Other than that, it's perfect!!!:D

Public Sub OpenWord()
Dim oWord As Word.Application
Set oWord = CreateObject("Word.Application")
oWord.Documents.Open ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\CalendarWordsDoc.docm")
With oWord
.Visible = True
End With
Set oWord = Nothing

End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Is there an autorun macro in the word document? Only the file opens here.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
The word document not as a template, as an autorun macro related to it.....and it does it all.........but it also opens up a folder
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
The word document not as a template, as an autorun macro related to it.....and it does it all.........but the macro to open the documebt also opens up a folder....if I just opened the document whereever I have it, it does not open up a folder
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I have no idea - it's only opening the file here, so its nothing in the macro. Sorry.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Since the document is a macro enabled document, should we change the code so that it is recognizing the type etc......

Public Sub OpenWord()
Dim oWord As Word.Application
Set oWord = CreateObject("Word.Application")
oWord.Documents.Open ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\CalendarWo rdsDoc.docm")
With oWord
.Visible = True
End With
Set oWord = Nothing

End Sub


 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I fixed it as the code re the document itself had in it the automatic close of the document but then it opens up to save it....so I took he automatic close out of it, and it works....Thanks so much.....And to tell you, as a template, it doesn't run the exactly code that comes with the document....I will look into that.....and hopefully, we can solve that line space area in my other thread please!!
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
When I looked at the word code, the macro which in the module for the "normal" document, it runs from the top if Microsoft Word Opjects, This Document, and the code in that area runs he macro called SelectAllLines ....and there is an error with this when I save the document as a template.....so here is the code and what should I change on it for the template so the document created from the template runs the SelectAllLines macro

Private Sub Document_Open()
Call SelectAllLines

End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
What does the macro do? You may be able to call it from the macro that opens the word document.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
V Macro to open Public Folders subfolder? Outlook VBA and Custom Forms 1
J VBS Script (macro) for word to open Outlook template. Outlook VBA and Custom Forms 2
L Outlook 2007 Macro Open Contact Folder Using Outlook 7
L Open an Exel Macro Enabled Worksheet Using Outlook 4
L Macro to Open a Contact Folder Using Outlook 15
A Cant open email with macro in attachment Using Outlook 1
L Macro to open another user's Inbox Outlook VBA and Custom Forms 2
J Macro to open email (like double click) in Outlook Outlook VBA and Custom Forms 4
D Macro to Close Open Messages Outlook VBA and Custom Forms 3
J Macro to run on Open Outlook VBA and Custom Forms 2
A Macro - Open new message, populate from and subject fields, and message text Outlook VBA and Custom Forms 1
S macro ist just worling wenn vba editor is open! Outlook VBA and Custom Forms 1
S Macro or plug-in to see if specific person was included in this email Outlook VBA and Custom Forms 3
U Macro for reminders,tasks,calendar Outlook VBA and Custom Forms 4
V macro runs slower on startup than after Outlook VBA and Custom Forms 3
N Macro to move all recipients to CC while replying Outlook VBA and Custom Forms 0
A VBA macro for 15 second loop in send and received just for 1 specific mailbox Outlook VBA and Custom Forms 1
G VBA Macro Calendar Printing Assistant 3
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
M Outlook macro to automate search and forward process Outlook VBA and Custom Forms 6
R Macro Schedule every day in Outlook Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
Healy Consultants Macro to remove inside organization distribution list email address when reply to all recepients Outlook VBA and Custom Forms 0
geofferyh Cannot get Macro to SAVE more than one message attachment??? Outlook VBA and Custom Forms 5
N How can I increase/faster outlook VBA Macro Speed ? Using Outlook 2
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2
D.Moore Folder view settings by VBA macro Outlook VBA and Custom Forms 57
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
Dave A Run macro on existing appointment when it changes Outlook VBA and Custom Forms 1
V Outlook Macro to show Flagged messages Outlook VBA and Custom Forms 2
O Run macro automatically at sending an email Using Outlook 11
R Retain Original Message When Forwarding With Macro Outlook VBA and Custom Forms 3
C Macro to add multiple recipients to message Outlook VBA and Custom Forms 3
B Reply and replyall macro is not working Outlook VBA and Custom Forms 1
O Macro - paste as plain text Outlook VBA and Custom Forms 2
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
witzker Macro to set contact reminder to next day 9:00 Outlook VBA and Custom Forms 45
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
E Copying data from e-mail attachement to EXCEL file via macro Outlook VBA and Custom Forms 38
M Macro to add date/time stamp to subject Outlook VBA and Custom Forms 4
R VBA macro - new message Outlook VBA and Custom Forms 3
S Example VBA Macro - To Conditionally Change the From Account and Add a BCC Address on Emails Outlook VBA and Custom Forms 11
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
B VBA Macro for assigning multiple Categories to an email in my Inbox Outlook VBA and Custom Forms 1
N Macro for attachment saved and combine Outlook VBA and Custom Forms 1
Sabastian Samuel HOW DO I FORWARD AN EMAIL WITH MACRO using an email that in the body of another email Outlook VBA and Custom Forms 3
C Search with Google Macro? Outlook VBA and Custom Forms 4
J Outlook 2013 Extract Flag Completed dates to Excel Macro Outlook VBA and Custom Forms 16
M Slow VBA macro in Outlook Outlook VBA and Custom Forms 5
Similar threads


















































Top