title: Calling a Word VBA Sub with arguments from Excel VBA
body: <p>I have a very simple Word sub in a dotm template:</p>
  
  <pre><code>Sub YHelloThar(msg As String)
      MsgBox (msg)
  End Sub
  </code></pre>
  
  <p>I then have an Excel sub:</p>
  
  <pre><code>Sub CallWordSub()
          Dim wdApp As Word.Application
          Dim newDoc As Word.Document
  
          'Word template location   
          strFile = "C:\Some\Folder\MyWordDoc.dotm"
          'Get or create Word application
          Set wdApp = GetObject(, "Word.Application")
          If wdApp Is Nothing Then
              Set wdApp = CreateObject("Word.Application")
          End If
          'Create new Word doc from template
          Set newDoc= wdApp.Documents.Add(strFile)
          'Call the YHelloThar sub from the word doc
          Call wdApp.Run(strFile &amp; "!YHelloThar", "Hello")
      End If
  End Sub
  </code></pre>
  
  <p>The last line gives me "Run-time Error '438': Object does not support this property or method."</p>
  
  <p>I'm not sure what I am doing wrong - everything I have looked up indicates this is the proper way to do call subs from different applications.</p>
  
  <p>Furthermore, if I change the last line to be a parameter-less call it suddenly works correctly.</p>