cplindem
10-23-2014, 01:37 PM
Hi,
I have a macro which is called by a custom button I added to the ribbon. The button is added by the customUI.xml file within my add-in (xlam file). I followed Ron de Bruin's guide (http://www.rondebruin.nl/win/s2/win001.htm). Microsoft also has their own documentation (http://msdn.microsoft.com/en-us/library/ee390805(v=office.11).aspx).
It usually works great. But sometimes the button disappears (i.e. it does not load). This seems to occur when I open a csv file directly (without Excel already open). My suspicion is that the call to load the button through xml fires before all workbook objects have loaded (because it's a csv file perhaps). Thus the button does not appear.
I found further explanations of this issue in a few old posts by user ZVI:
Problem with Auto Open Macro (http://www.mrexcel.com/forum/excel-questions/395270-problem-auto-open-macro.html#post1967868)
Find workbook name when macro run in add-in file (http://www.vbaexpress.com/forum/showthread.php?30552-Find-workbook-name-when-macro-run-in-add-in-file&p=205472#post205472)
Excel add-in does not load properly. (http://www.mrexcel.com/forum/excel-questions/471610-excel-add-does-not-load-properly-4.html)
I know I'm not allowed to PM him directly with this question. But I was hoping someone might know a solution. He suggests using Application.OnTime in a Workbook_Open() sub to trigger, because it will wait for the objects to load. I'm not sure I can follow his suggestions, because they are of course directly within VBA, and my code is triggered in the xml file. I don't know how to accomplish the same thing in xml.
Any ideas?
I have a macro which is called by a custom button I added to the ribbon. The button is added by the customUI.xml file within my add-in (xlam file). I followed Ron de Bruin's guide (http://www.rondebruin.nl/win/s2/win001.htm). Microsoft also has their own documentation (http://msdn.microsoft.com/en-us/library/ee390805(v=office.11).aspx).
It usually works great. But sometimes the button disappears (i.e. it does not load). This seems to occur when I open a csv file directly (without Excel already open). My suspicion is that the call to load the button through xml fires before all workbook objects have loaded (because it's a csv file perhaps). Thus the button does not appear.
I found further explanations of this issue in a few old posts by user ZVI:
Problem with Auto Open Macro (http://www.mrexcel.com/forum/excel-questions/395270-problem-auto-open-macro.html#post1967868)
Find workbook name when macro run in add-in file (http://www.vbaexpress.com/forum/showthread.php?30552-Find-workbook-name-when-macro-run-in-add-in-file&p=205472#post205472)
Excel add-in does not load properly. (http://www.mrexcel.com/forum/excel-questions/471610-excel-add-does-not-load-properly-4.html)
I know I'm not allowed to PM him directly with this question. But I was hoping someone might know a solution. He suggests using Application.OnTime in a Workbook_Open() sub to trigger, because it will wait for the objects to load. I'm not sure I can follow his suggestions, because they are of course directly within VBA, and my code is triggered in the xml file. I don't know how to accomplish the same thing in xml.
Any ideas?