hi tryp,
it's working now. thanks for replying. =)
i just inserted the saveas command in the function below: i'm just wondering when i click on the file-->save as, the value of the save as type is Document Template (*.dot) and the default file name is Document.dot. i tried using the command (Word.ActiveDocument.SaveAs FileName:="Document1.doc", FileFormat:=wdFormatDocument) in the code but it's not working. is this the right command?
Sub Main(strPath)
Dim sFileName As String
...
...
Const FUNCTION_NAME = "Main()"
On Error GoTo Error_Handler
sFileName = strPath
If sFileName = "" Or Right(sFileName, 1) = "\" Then
'User did not select any file!!!
Exit Sub
End If
'Open the file
nFileNum = FreeFile
Open sFileName For Input As #nFileNum
...
...
...
...
'--->Maybe I can place the renaming of .dot file to .doc file here. But how? I still can't find the syntax in web or in any forum. =(
Word.ActiveDocument.SaveAs "Document1.doc"
'--->
If Not bSuccess Then
MsgBox "The Report was not created successfully.", vbCritical
Else
MsgBox "The Fumiguide Report was created successfully.", vbInformation
End If
'Go to the first field
ActiveDocument.Bookmarks("BeginCursor").Select
Exit Sub
Error_Handler:
sErrorString = FUNCTION_NAME & vbCrLf & vbCrLf & "Error: " & Err.Number & " - " & Err.Description
MsgBox sErrorString, vbCritical, "Error"
End Sub