How to slove this doc problem...Create a new document based on the template

Hi ,my script is runnig well and it export to word.

Create a new document based on the template .But problem is …i had save that templete document in drive “C” with name “quote.dot”. but the problem is that when the user is new or if he has not stored this templete docujment in his machine then it won’t work.

Did you get my point…

For this i have to make sure when the database is open first time in any machine then it will save that templete document in his c drive and then this will work fine.

I dont know how to do this ?Do you have any script for the same.This is my code…

CustName=uidoc.FieldGetText(“CustName”)

	Contact=uidoc.FieldGetText ("Contact")

	username=uidoc.FieldGetText("username") 

	usermailid=uidoc.FieldGetText ("usermailid")

'Create the Word object:

	Set word = CreateObject("Word.Application") 'Create Word object

	Call word.documents.add("quote.dot") 'Create a new document based on the template "quote.Dot"

	Set worddoc = word.activedocument 'Get a handle for the active document

'Assign the field values:

'

	worddoc.FormFields(1).result = CustName

	worddoc.FormFields(2).result = Contact

	worddoc.FormFields(3).result = username

	worddoc.FormFields(4).result = usermailid

	worddoc.FormFields(5).result = Contact

Pls help.

Thanks

Subject: how to slove this doc problem…Create a new document based on the template

Store the template as an attachment in a notes document. Then You can examine if the template exists on the users directory, and if it doesn’t - simply detach the attachment and let Your script run as it should.

hth

Subject: RE: how to slove this doc problem…Create a new document based on the template

Thanks Kenneth for your response.

But how i will examine that template in user directory…

i mean by which code…i have not very much good in script.

Please help me…i you have some code

Thanks…

Subject: RE: how to slove this doc problem…Create a new document based on the template

Rajeev,

Here is my snippet for checking if a file exists:

Function doesFileExist(strPath As String) As Integer

Dim tmpFile As String

doesFileExist = False

If strPath="" Then Exit Function

On Error Goto NoFile_Error	

tmpFile = Dir$(strPath)

If Len(tmpFile)<>0 Then doesFileExist = True

Exit Function

NoFile_Error:

Err = 0

doesFileExist = False

Exit Function

End Function