matapagi2019
New Member
- Joined
- Mar 8, 2019
- Messages
- 8
I want the button on userformTombol in document "Agendaku.docm" activate after The Excel application Quit.
What is the mistakes in the following code: ? (error message : Object dosn't support this property or method)
Thank you all !
What is the mistakes in the following code: ? (error message : Object dosn't support this property or method)
Code:
Private Sub CommandButton1_Click()Dim ObjWord As Object
Dim ObjDoc As Object
Dim ObjForm As Object
Set ObjWord = GetObject(, "Word.Application")
Set ObjDoc = ObjWord.Documents("D:\Agendaku.docm")
ObjWord.Visible = True
Set ObjForm = ObjWord.ObjDoc.UserFormTombol
ObjForm.CommandButton1.Enabled = True
ObjForm.CommandButton3.Enabled = False
ActiveWorkbook.Save
'ActiveWorkbook.Close
Windows.Application.Quit
End Sub
Thank you all !