title: Run Code In Worksheets Class Code Module In Another Workbook
body: <p>This code is in a Workbook. ( In a Worksheets Class code Module )</p>
  
  <pre><code>Sub Testie()
  Dim FullPathAndName As String
   Let FullPathAndName = "'" &amp; ThisWorkbook.Path &amp; "\" &amp; "NeuProAktuelleMakros.xlsm'"
   Application.Run Macro:=FullPathAndName &amp; "!FrmProTypeIn", Arg1:=42
  End Sub
  </code></pre>
  
  <p>In another Workbook, named “NeuProAktuelleMakros.xlsm”, which is in the same Folder, I have this code, (in a Normal Code Module):</p>
  
  <pre><code>Sub FrmProTypeIn(MyArg As Long)
   MsgBox prompt:="Got Here :). The answer is " &amp; MyArg &amp; " , I forgot the question"
  End Sub
  </code></pre>
  
  <p>If I run the first code, it makes the second code run , ( which tells me I got there and that the answer is 42, I forgot the question ) </p>
  
  <p>I would prefer to have the code, FrmProTypeIn() , (which is currently in a Normal Code Module)  to be in a Worksheets Code Module. The Worksheet Name is “FoodsLookUpTable”. The Worksheet Code Name is “Tabelle11”</p>
  
  <p>Is this possible and can you give me the syntax?</p>
  
  <p>If that is not possible, what about a simple work around? – The obvious thing I can think of is to have a Call ing code in a normal Module in Workbook “NeuProAktuelleMakros.xlsm” thus:</p>
  
  <pre><code>Sub CallFrmProTypeIn(MyArg As Long)
   Application.Run Macro:=Worksheets("FoodsLookUpTable").FrmProTypeIn(MyArg)
  End Sub
  </code></pre>
  
  <p>Then I modify the first code slightly to this:</p>
  
  <pre><code>Sub Testies2()
  Dim FullPathAndName As String
   Let FullPathAndName = "'" &amp; ThisWorkbook.Path &amp; "\" &amp; "NeuProAktuelleMakros.xlsm'"
   Application.Run Macro:=FullPathAndName &amp; "!CallFrmProTypeIn", Arg1:=42
  End Sub
  </code></pre>
  
  <p>That workaround works. But maybe there is a simpler way?</p>