|
-
May 11th, 2010, 06:30 AM
#1
Thread Starter
Lively Member
[RESOLVED] Word Template in Outlook
Hello Everyone,
Sounds weird, but office politics stops me from creating a macro button through word. Plus the limitations on our network, we can't have shortcuts on our desktops.
So I was thinking, I use Outlook allot and its one of the only app that is open all the time, I've created macros for other mail templates as macro buttons, but I was thinking, why not create one for a word template I use all the time,
Here the code I've tried, but I can't get it to work the way it should, any help would be awesome. 
Code:
Sub Faultsheet()
Set appWord = GetObject(, "Word.Application")
Set docs = appWord.Documents
docs.OpenTemplate = ("K:\AA_IT_Folder\Faults & Enquiry - Logged Calls\IT FAULT & ENQUIRY REPORTING FORM.dot")
End Sub
-
May 11th, 2010, 06:50 AM
#2
Re: Word Template in Outlook
Try this example which uses Latebinding...
Code:
Sub Faultsheet()
Dim oWordApp As Object, oWordDoc As Object
Dim FlName As String
FlName = "K:\AA_IT_Folder\Faults & Enquiry - Logged Calls\IT FAULT & ENQUIRY REPORTING FORM.dot"
'~~> Establish an Word application object
On Error Resume Next
Set oWordApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set oWordApp = CreateObject("Word.Application")
End If
Err.Clear
On Error GoTo 0
oWordApp.Visible = True
Set oWordDoc = _
oWordApp.Documents.Open(FlName)
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
May 11th, 2010, 07:23 AM
#3
Thread Starter
Lively Member
Re: Word Template in Outlook
Many thanks Koolsid, as always you are the lord of VBA!
Works like a charm, but alike my previous code, it opens the dot file, idealy id like it to open 'new template fresh' if possible?
-
May 11th, 2010, 07:55 AM
#4
Re: Word Template in Outlook
You mean... Replacing
Set oWordDoc = _
oWordApp.Documents.Open(FlName)
with
Code:
Set oWordDoc = oWordApp.Documents.Add(Template:=FlName)
Also the code that I gave you in my first post, you can make the changes after you open the tmeplate and then save the word document as .Doc instead of .Dot
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
May 11th, 2010, 08:10 AM
#5
Thread Starter
Lively Member
Re: Word Template in Outlook
Thats the puppy! Many thanks again!
-
May 11th, 2010, 08:15 AM
#6
Re: [RESOLVED] Word Template in Outlook
You are welcome
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|