Solved

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

Posted on 2003-11-11
1
197 Views
Last Modified: 2010-04-08
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
Comment
Question by:arakis
1 Comment
 
LVL 11

Accepted Solution

by:
Steiner earned 350 total points
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now