title: VBA - How do I pass a variable into a network file path
body: <p>I am very new to VBA and honestly do not know what I am doing. </p>
  
  <p>Problem:
  I need a macro to go to a file networks path based on an user's input. But I do not know if it is possible to pass two variables into a Network path. Or if there is some other way to do this. </p>
  
  <p>Ex) The user would choose the FileName they want and the IP Address of where that file is located in the Master Excel sheet from a drop down list. There are many types of files and IP Addresses, so I do not want to hard code them all into the macro. </p>
  
  <p>Currently all I have is the below hard code that states the actual location (IP Address) and FileName.</p>
  
  <pre><code>Dim vPID As Variant      vPID = Shell("notepad.exe ""\\105.xxx.xx.xx\C:\FileName""", vbNormalFocus)
  </code></pre>
  
  <p>Can someone point me to a good resource that I can research? I have been searching online for hours and cannot find anything that directly relates to what I want to do.</p>
  
  <p>I tried the below, but the network path cannot be found due to how I incorrectly inserted the variables. </p>
  
  <p>Note: The file that will be opened is in XML format that will be opened in notepad and not converted to .xls.</p>
  
  <p>Note: ToolID references an IP Address in the cell range "G6"
  FileName references a cell range in "I3"</p>
  
  <pre><code>Dim ToolID As String
  Dim FileName As String
  Dim vPID As Variant
  Dim GetFile As Workbook
  
  Set GetFile = ThisWorkbook
  FileName = ThisWorkbook.Worksheets("Sheet1").Range("G6").Value
  ToolID = ThisWorkbook.Worksheets("Sheet1").Range("I3").Value
  
  vPID = Shell("notepad.exe ""\\ToolID\C:\FileName""", vbNormalFocus)
  </code></pre>