Solved

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

Posted on 2003-11-11
1
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 11

Accepted Solution

by:
Steiner earned 350 total points
ID: 9729966
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

697 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