Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,566
- Office Version
- 365
- 2016
- Platform
- Windows
I thought this should be relatively easy ...
The code in blue is supposed to close the open instance of Word document "HPE-FR.docx". When it reaches the line in red, it throws this error ...
"Bad file name."
What needs to be done to resolve this problem? The file name matches the open document.
The code in blue is supposed to close the open instance of Word document "HPE-FR.docx". When it reaches the line in red, it throws this error ...
"Bad file name."
What needs to be done to resolve this problem? The file name matches the open document.
Rich (BB code):
Private Sub tglb_hpe_fldr_Click()
Set WordApp = CreateObject("word.Application")
With Me
With .tglb_hpe_fldr
If .BackColor = RGB(102, 0, 204) And .Value = False Then
MsgBox "File is open! Close it!"
WordApp.Documents("HPE-FR.docx").Close
WordApp.Quit
Set WordApp = Nothing
End If
If .BackColor = RGB(0, 153, 211) Then
If DocOpen("HPE-FR.docx") = False Then
WordApp.Documents.Open path_name & "HPE-FR.docx"
WordApp.Visible = True
Set WordApp = Nothing
'WordApp.Activate
.Value = True
End If
.BackColor = RGB(102, 0, 204)
Exit Sub
Else
If .Value = True Then
.tb_of_rpt.Value = .tb_of_rpt.Value + 1
Else
.tb_of_rpt.Value = .tb_of_rpt.Value - 1
End If
End If
End With
End With
End Sub