Is there a way using VBA to open an existing document or a template as an
unnamed document, similar to double-clicking a .DOT file and having it open
as Document1?

I'm trying this but it only opens the document, which I don't want
overwritten:

Dim wd as Word.Application
Dim wDoc as Word.Document
Dim WordFile as string
WordFile = "test.doc"

Set wDoc = wd.Documents.Open(WordFile)

Thanks,

King Wilder

RE: Open as New document... by NOSPAMORANYPROCESSEDMEATOFANYKINDWHATSOEVERgarethdart24

NOSPAMORANYPROCESSEDMEATOFANYKINDWHATSOEVERgarethdart24
Thu Sep 29 00:12:01 CDT 2005

Simple - you need to do this instead:

Sub openTemplate()

Word.Documents.Add Template:="C:\path\To\My\Template.dot"

End Sub

That'll open a document, based on a template whose path you supply, as
'DocumentN', where N is the current number of docs, 1 to begin with.

G

"K. Wilder" wrote:

> Is there a way using VBA to open an existing document or a template as an
> unnamed document, similar to double-clicking a .DOT file and having it open
> as Document1?
>
> I'm trying this but it only opens the document, which I don't want
> overwritten:
>
> Dim wd as Word.Application
> Dim wDoc as Word.Document
> Dim WordFile as string
> WordFile = "test.doc"
>
> Set wDoc = wd.Documents.Open(WordFile)
>
> Thanks,
>
> King Wilder
>

RE: Open as New document... by KWilder

KWilder
Thu Sep 29 12:18:05 CDT 2005

Ganeth,

That did it!

Thanks a bunch,

King Wilder


"Ganeth" wrote:

> Simple - you need to do this instead:
>
> Sub openTemplate()
>
> Word.Documents.Add Template:="C:\path\To\My\Template.dot"
>
> End Sub
>
> That'll open a document, based on a template whose path you supply, as
> 'DocumentN', where N is the current number of docs, 1 to begin with.
>
> G
>
> "K. Wilder" wrote:
>
> > Is there a way using VBA to open an existing document or a template as an
> > unnamed document, similar to double-clicking a .DOT file and having it open
> > as Document1?
> >
> > I'm trying this but it only opens the document, which I don't want
> > overwritten:
> >
> > Dim wd as Word.Application
> > Dim wDoc as Word.Document
> > Dim WordFile as string
> > WordFile = "test.doc"
> >
> > Set wDoc = wd.Documents.Open(WordFile)
> >
> > Thanks,
> >
> > King Wilder
> >