Way to capture double click to open file?

738 Views Asked by At

Is there a way to have an Excel macro to check what file I double clicked on to open.

When I open that file, the Add-Ins installed load first, then the file I clicked on loads. How can I write code inside one of my Add-Ins to check what the filename is that I am trying to open?

1

There are 1 best solutions below

0
On BEST ANSWER

I tackled this by using 2 instances of Workbook_Open inside an excel Addin.

When a file is loaded, the addin starts up, and checks to see if there are any active workbooks. If there is none, then we wait a little bit and check again, looped as many times as you deem necessary, or until there is a valid workbook open. This makes sure your computer has time to load up the excel file. Once there is an active workbook, we process it to make sure it is not the workbook of the addin. If it is, then we exit our code. If it isn't then we Do Stuff.

I solved 2 of my questions on this site with the same code that can be found HERE

Note: I left out the parts where I Do Stuff... because really it's there to do anything you want with it. The code in the link just does what the previous paragraph describes.