How to open current word document? Please help me...
In the database saving a lots of files which are differentiate by ID. Same ID could have more than one but different date. Im trying to create the code to retrieve the word document with latest current date:
If FileExist(strFileName) Then
objword.Documents.Open strFileName
Call WordSetting("Protect")
ElseIf FileExist(strNewFileName) Then
Set objTempWord = New Word.Application
objTempWord.Visible = False
'strNewFileName = Format(Date, "MM/DD/YYYY")
'FileExist(strNewFileName)
objTempWord.Documents.Open strNewFileName, "", "", "", "", "", "", "", "", Format(strNewFileNa me, "DD/MMM/YYYY hh:nn:ss", "", vbUseSystem)
Call WordSetting("Protect")
Function for FileExist:
Public Function FileExist(strFileExist As String) As Boolean
On Error GoTo SystemError
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
FileExist = fs.FileExists(strFileExist)
Set fs = Nothing
On Error GoTo 0
Exit Function
Re: How to open current word document? Please help me...
objTempWord.Documents.Open strNewFileName, "", "", "", "", "", "", "", "", Format(strNewFileName, "DD/MMM/YYYY hh:nn:ss", "", vbUseSystem)
Cause the error " Type mismatch...."...
Re: How to open current word document? Please help me...
Change the line to:
Code:
objTempWord.Documents.Open strNewFileName, "
and it will open the available options (if you did things right)