• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

'If exist' code syntax when Custom Form printing via Word template

I have created a custom outlook form and have used the Word template method for printing it.

Within the Outlook form code I can define the template path/filename as e.g. 'strTemplate = "c:\templates\formprn.dot"' and all works OK.

However the word template could be in one of two locations so I would like to try something similar to the following:-

'If exist "c:\templates\formprn.dot" then
   strTemplate = "c:\templates\formprn.dot"
  Else
   strTemplate = "d:\templates\formprn.dot"
End if'

However, above syntax/command structure is incorrect and have been unable to find any sample code.

Can anybody point me in the right direction?

A.  


0
arakis
Asked:
arakis
1 Solution
 
SteinerCommented:
To check wheter a file exists in a specific location, use dir():

If Dir ("C:\templates\formprn.dot") <> "" then msgbox "It exists"
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now