When the user clicks "Button1" once, the file "MyAgenda.xlsx" opens.
How do I prevent Excel from opening the file "MyAgenda.xlsx" when the user clicks "Button1" on the second click, third, and so on ?
Because from the following code, the file "MyAgenda" continues to open again and again every time the user clicks on the second one and so on.
Code:
Private Sub Button1_Click()
Dim ObjExcel
Dim ObjXls
Set ObjExcel = CreateObject("Excel.Application")
Set ObjXls = ObjExcel.Workbooks.Open("D:\MyAgenda.xlsx")
ObjExcel.Visible = True
End Sub
For all assistance, I am very grateful.