<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Run Macro On VBA Project Load in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/run-macro-on-vba-project-load/m-p/7222640#M7901</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a VBA project which contains several macros, but one in particular loads a toolbar which can run all of the others. Currently I am loading in the VBA project and running the toolbar loading macro manually. From looking around I realize it is possible to automate all of this on startup or drawing creation by using a separate acad.dvb file or using LISP, but I am not necessarily interested in automating the Project Loading. What I would be particularly interested in knowing is if there is some way to run&amp;nbsp;that toolbar loading macro (or some small amount of code)&amp;nbsp;once the VBA project is loaded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Essentially the behavior I am trying to spoof, is that of an old Lisp routine which upon application load would bring in a customization file automatically. If the short answer is no, there's no way to do that, I will find out what else will work, but anyone knows of a way to get that behavior, I would welcome the suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2017 15:12:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-07-12T15:12:14Z</dc:date>
    <item>
      <title>Run Macro On VBA Project Load</title>
      <link>https://forums.autodesk.com/t5/vba-forum/run-macro-on-vba-project-load/m-p/7222640#M7901</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a VBA project which contains several macros, but one in particular loads a toolbar which can run all of the others. Currently I am loading in the VBA project and running the toolbar loading macro manually. From looking around I realize it is possible to automate all of this on startup or drawing creation by using a separate acad.dvb file or using LISP, but I am not necessarily interested in automating the Project Loading. What I would be particularly interested in knowing is if there is some way to run&amp;nbsp;that toolbar loading macro (or some small amount of code)&amp;nbsp;once the VBA project is loaded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Essentially the behavior I am trying to spoof, is that of an old Lisp routine which upon application load would bring in a customization file automatically. If the short answer is no, there's no way to do that, I will find out what else will work, but anyone knows of a way to get that behavior, I would welcome the suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 15:12:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/run-macro-on-vba-project-load/m-p/7222640#M7901</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-12T15:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Run Macro On VBA Project Load</title>
      <link>https://forums.autodesk.com/t5/vba-forum/run-macro-on-vba-project-load/m-p/7223496#M7902</link>
      <description>&lt;P&gt;What method(s) are using to load the VBA project?&amp;nbsp; There is no built in function such as Initialize or Init that is executed upon the loading of a VBA module in AutoCAD, but Document related events are registered during the loading of a VBA module.&amp;nbsp; With a Document event, it is plausible that you might be able to accomplish what you are trying to do.&amp;nbsp; For example, you could watch for the end of the VBALOAD or -VBALOAD commands and then do something which could be the loading of the toolbar.&amp;nbsp; The event handler must be defined in the ThisDrawing class module of the VBA project.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following example watches for the end of the VBALOAD or -VBALOAD commands, and then displays a message box for each loaded DVB project file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Private Sub AcadDocument_EndCommand(ByVal CommandName As String)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; If CommandName = "VBALOAD" Or CommandName = "-VBALOAD" Then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Test for toolbar here or just execute the code you want&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim VBEModel As VBE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set VBEModel = ThisDrawing.Application.VBE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oPrj As VBProject&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each oPrj In VBEModel.VBProjects&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "Project Name: " &amp;amp; oPrj.Name &amp;amp; vbLf &amp;amp; _&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "File Name: " &amp;amp; oPrj.FileName&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next oPrj&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; End If&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 19:49:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/run-macro-on-vba-project-load/m-p/7223496#M7902</guid>
      <dc:creator>ambrosl</dc:creator>
      <dc:date>2017-07-12T19:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Run Macro On VBA Project Load</title>
      <link>https://forums.autodesk.com/t5/vba-forum/run-macro-on-vba-project-load/m-p/7223552#M7903</link>
      <description>&lt;P&gt;Lee,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your response, it had not occurred to me to check each command. Turned out I was using the APPLOAD command and sure enough once I plugged that into your snippet and tracked down my project I was able to run my toolbar Macro. 10/10. Thanks very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 20:12:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/run-macro-on-vba-project-load/m-p/7223552#M7903</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-12T20:12:46Z</dc:date>
    </item>
  </channel>
</rss>

