title: Passing value to excel inputbox from VB.NET
body: <p>I am trying to automate data population on some excel sheets that have some macros. Now the excel is protected and I cannot get the secret key. Now I am able to run the macros but when I try to pass arguments I get arguments mismatch.</p>
  
  <p>If I just run the macro with the name, I get an <code>inputbox</code> which takes an extra argument as input and auto generates some of the values for the columns. I have to manually enter this value into the <code>inputbox</code> as of now. Is there any way that I could automate that process, i.e capture the inputbox thrown by the macro in the vb.net script and enter the values from there? i.e., I would like to run the macro and after I get the popup asking me to enter some value, use the vb.net code to enter the value to that popup.</p>
  
  <p>Here is what I have till now</p>
  
  <pre><code>Public Class Form1
      Dim excelApp As New Excel.Application
      Dim excelWorkbook As Excel.Workbook
      Dim excelWorkSheet As Excel.Worksheet
  
      Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
          excelWorkbook = excelApp.Workbooks.Open("D:/excelSheets/plan_management_data_templates_network.xls")
          excelApp.Visible = True
  
          excelWorkSheet = excelWorkbook.Sheets("Networks")
  
          With excelWorkSheet
              .Range("B7").Value = "AR"
          End With
  
          excelApp.Run("createNetworks")
          // now here I would like to enter the value into the createNetworks Popup box
          excelApp.Quit()
          releaseObject(excelApp)
          releaseObject(excelWorkbook)
      End Sub
  </code></pre>
  
  <p>Macro definition</p>
  
  <pre><code>createNetworks()
  //does so basic comparisons on existing populated fields
  //if true prompts an inputbox and waits for user input.
  </code></pre>
  
  <p>This stall my vb.net script too from moving to the next line.</p>