Version

S

Scafidel

I asked this in Access and it was suggested I post here.
Using Access 2007 with a form that merges fields to various Word 2007
documents using code which includes:

Const conTEMPLATE_NAME = "C:\FORMS\Spec1.dotm"

This is shared with other employees but occassionally someone doesn't have
Word 2007. In the form folder that's copied to their machine are templates
named both *.dotm and *.dot, but I'm having to go in the computer to change
the code from *.dotm to *.dot templates.

Question: What code would find Word version, i.e., If V2007 then pull up
dotm, else use dot?

Thanks
 
G

Graham Mayor

If Application.version = 12 Then
'Word 2007
Const conTEMPLATE_NAME = "C:\FORMS\Spec1.dotm"
Else
'Not Word 2007
Const conTEMPLATE_NAME = "C:\FORMS\Spec1.dot"
End If

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Scafidel

The code seems to determine the Access Version, not Word and didn't work on
the Computer with Word 2003. It still brought up the *.dotm template. I
also tried using: If Word.Application.Version = 12 and got an Active-X
complaint.
Any other suggestions to determine the Version of Word from Access?
Thanks
 
G

Graham Mayor

I have scant knowledge of Access, however

Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim strMyTemplate As String
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err Then
Set wdApp = CreateObject("Word.Application")
End If
'MsgBox wdApp.Version
If wdApp.Version = 12 Then
strMyTemplate = "C:\FORMS\Spec1.dotm"
Else
strMyTemplate= "C:\FORMS\Spec1.dot"
End If
Set wdDoc = wdApp.Documents.Add(strMyTemplate)

appears to work from Outlook vba

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top