Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-13-2019, 05:43 AM
matapagi2019 matapagi2019 is offline How to prevent the file from opening again on the second click? Windows XP How to prevent the file from opening again on the second click? Office 2007
Novice
How to prevent the file from opening again on the second click?
 
Join Date: Mar 2019
Posts: 12
matapagi2019 is on a distinguished road
Default How to prevent the file from opening again on the second click?

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.
Reply With Quote
 

Tags
file, open, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to prevent the file from opening again on the second click? VBA Code to prevent word document trying to open links at opening John Pryor Word VBA 4 07-17-2018 01:51 AM
Prevent 'click anywhere in slide' tradedog PowerPoint 2 06-12-2017 10:17 AM
Any way to prevent mail appearing as read after opening from a desktop alert? pumpkin_feet Outlook 0 10-24-2011 06:55 AM
Prevent Appointment Item from opening? happyaslarry Outlook 0 01-06-2011 08:46 PM
Prevent highlighted only message from opening Rickkimbrell Outlook 2 12-16-2009 07:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft