In Excel, I want to create a link to a Word template. However, I want Word
to open in a new document and not open the template itself. Do I need
programming to do this (and assign it to a command button instead)? Thanks!
--
Steve C
In Excel, I want to create a link to a Word template. However, I want Word
to open in a new document and not open the template itself. Do I need
programming to do this (and assign it to a command button instead)? Thanks!
--
Steve C
A hyperlink will open a the link - so yes, if you want to do FILE NEW (i.e a
new document based on the template) then you will need a macro - so a button
would be the obvious way forward!
"Steve C" <[email protected]> wrote in message
news:[email protected]...
> In Excel, I want to create a link to a Word template. However, I want
Word
> to open in a new document and not open the template itself. Do I need
> programming to do this (and assign it to a command button instead)?
Thanks!
> --
> Steve C
What is the programming code I would need to make it open as a new document
instead of a template? Thanks!
--
Steve C
"Steve C" wrote:
> In Excel, I want to create a link to a Word template. However, I want Word
> to open in a new document and not open the template itself. Do I need
> programming to do this (and assign it to a command button instead)? Thanks!
> --
> Steve C
Can you add a shape/button and assign a macro to that shape?
Option Explicit
Sub testme01()
Dim oWord As Object
Dim myWordTemplate As String
Dim testStr As String
myWordTemplate = "c:\msoffice\templates\1033\Elegant Fax.dot"
testStr = ""
On Error Resume Next
testStr = Dir(myWordTemplate)
On Error GoTo 0
If testStr = "" Then
MsgBox myWordTemplate & " doesn't exist"
Exit Sub
End If
On Error Resume Next
Set oWord = GetObject(, "Word.Application")
If Err Then
Set oWord = CreateObject("Word.Application")
End If
oWord.Visible = True
oWord.Documents.Add Template:=myWordTemplate
End Sub
Steve C wrote:
>
> In Excel, I want to create a link to a Word template. However, I want Word
> to open in a new document and not open the template itself. Do I need
> programming to do this (and assign it to a command button instead)? Thanks!
> --
> Steve C
--
Dave Peterson
I created a command button and assigned your code to it. Works perfectly.
Thanks, Dave!
--
Steve C
"Dave Peterson" wrote:
> Can you add a shape/button and assign a macro to that shape?
>
> Option Explicit
> Sub testme01()
>
> Dim oWord As Object
> Dim myWordTemplate As String
> Dim testStr As String
>
> myWordTemplate = "c:\msoffice\templates\1033\Elegant Fax.dot"
>
> testStr = ""
> On Error Resume Next
> testStr = Dir(myWordTemplate)
> On Error GoTo 0
> If testStr = "" Then
> MsgBox myWordTemplate & " doesn't exist"
> Exit Sub
> End If
>
> On Error Resume Next
> Set oWord = GetObject(, "Word.Application")
> If Err Then
> Set oWord = CreateObject("Word.Application")
> End If
>
> oWord.Visible = True
> oWord.Documents.Add Template:=myWordTemplate
>
> End Sub
>
> Steve C wrote:
> >
> > In Excel, I want to create a link to a Word template. However, I want Word
> > to open in a new document and not open the template itself. Do I need
> > programming to do this (and assign it to a command button instead)? Thanks!
> > --
> > Steve C
>
> --
>
> Dave Peterson
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks