title: Get data from textbox in Word-UserForm
body: <p>I have a Word document based on a template for invoices and a database in Excel containing two tables: Company and Person.</p>
  
  <p>I want to put some string into the textbox in the userform in Word which will then be searched in Excel. Excel shall return the values to a MultiColumn-Listbox located in another UserForm (this userform will only show if there is more than 1 result for the searched string).</p>
  
  <p>This is the code I have in Word to run the macro, which actually gets started:</p>
  
  <pre><code>CSearchText = UFCompanySearch.tbSearchCompany.Value 'Textbox -&gt; Search-String
  
  xlWB.Application.Run("SearchCompany")
  </code></pre>
  
  <p>This only works when SearchCompany is a sub or a function with no further specifications, so</p>
  
  <pre><code>Function SearchCompany(SearchText As String)
  </code></pre>
  
  <p>doesn't work as I cannot run the Macro as follows:</p>
  
  <pre><code>xlWB.Application.Run("SearchCompany("SomeCompany")") 'NOTE!
  </code></pre>
  
  <p>NOTE: This will NOT work!!</p>
  
  <p>To fill the Listbox in the UserForm I think there is the possibility to fill it with an Excel table, so this should somehow work out.</p>
  
  <p>THIS is the PROBLEM:</p>
  
  <p>I cannot refer to the Search-TextBox in the Userform which is located in the word Document as neither "Doc!" nor "Doc." works. Like this I can't search the cells for the string. This is the code I have to find cells containing the string:</p>
  
  <pre><code>IF (InStr(xlComp.Cells(Row, 1), CSearchText) &gt; 0) Or _
      (InStr(xlComp.Cells(Row, 2), CSearchText) &gt; 0) Or _
      (InStr(xlComp.Cells(Row, 3), CSearchText) &gt; 0) Then
  </code></pre>
  
  <p>This searches the Columns A-C for the entered string. (Code I found somewhere... I have been searching too much to know where from ^.^)</p>
  
  <p>Is there a way to address the UserForm in Word or a workaround to get the "SearchText" from the userform to Excel?</p>
  
  <p>I'm quite new in VBA, so the more detailed your answer the more probable I will understand it.</p>