title: How to convert string to workbook name
body: <pre><code>Sub openwb()
  
  Dim x260path As String
  
  x260path = "E:\sarath\PTMetrics\20131002\D8 L538-L550 16MY\D8 L538-L550_16MY_Powertrain Metrics_" &amp; Format(Date, "YYYYMMDD") - 1
  
  Workbooks("x260path").Activate
  
  ActiveWorkbook.SaveAs ["E:\sarath\PTMetrics\20131002\D8 L538-L550 16MY\D8 L538-L550_16MY_Powertrain Metrics_" &amp; Format(Date, "YYYYMMDD")]
  
  Debug.Print x260path
  
  End Sub
  </code></pre>
  
  <p>Here, when i execute, an error says "subscript out of Range". And it appears on 4th line.when i use 'workbook' to declare 'x260path' instead of string, It shows another error saying "Object variable or with block variable not set" on line 3. Can u help?Why is this happening?</p>