I have a function that open a word document to write notes in it.The functions works OK but only when a doc file name Notes is available.is it possible to create this word file in case it is not existing? In my function there is line called create object but somehow it does not work.
My function is :
Public Function MyNotes()
Dim appW As Object
On Error Resume Next
Set appW = GetObject(, "Word.Application")
Dim nErr As Integer
nErr = Err
On Error GoTo 0
If nErr Then
Set appW = CreateObject("Word.Application")
End If
appW.Visible = True
appW.Documents.Open (" C:\be\Notes")
End Function
My function is :
Public Function MyNotes()
Dim appW As Object
On Error Resume Next
Set appW = GetObject(, "Word.Application")
Dim nErr As Integer
nErr = Err
On Error GoTo 0
If nErr Then
Set appW = CreateObject("Word.Application")
End If
appW.Visible = True
appW.Documents.Open (" C:\be\Notes")
End Function