title: Not able to run .vbs file from jenkins which is having excel script
body: <p>I’m new to Jenkins and now I'm doing basic level of execution. And I need your help resolve my issue. Issue Description: I’m trying to run the .VBS file by using jenkins and getting below error:</p>
  
  <p>C:\Users\Amar\Desktop\Test_Sample.vbs(3, 2) Microsoft Excel: Microsoft Excel cannot access the file ‘C:\Users\Amar\Desktop\New.xlsx’. </p>
  
  <p><strong>There are several possible reasons:</strong></p>
  
  <ul>
  <li>The file name or path does not exist.</li>
  <li>The file is being used by another program.</li>
  <li>The workbook you are trying to save has the same name as a currently
  open workbook.</li>
  </ul>
  
  <p>I have not opened any excel file and path also correct.</p>
  
  <p>please find below batch command : CScript “C:\Users\Amar\Desktop\Test_Sample.vbs”</p>
  
  <p>And in Test_Sample.vbs file having:</p>
  
  <pre><code>Dim ExcelObj, WbookObj, mysheet
  Set ExcelObj= CreateObject("excel.application")  
  Set WbookObj= ExcelObj.workbooks.open("C:\Users\Amar\Desktop\New.xlsx")
  Set mysheet= ExcelObj.ActiveWorkbook.Worksheets("Sheet1") 
  ExcelObj.Visible = False  
  ExcelRowCount = mysheet.UsedRange.Rows.Count    
  For Iterator = 2 To ExcelRowCount  
      ModuleName   =   Ucase(Trim(mysheet.Cells(Iterator,1)))  
      ExecutionFlag = Ucase(Trim(mysheet.Cells(Iterator,2)))   
      if (moduleName="Raj") Then   
          Set qtApp = CreateObject("QuickTest.Application")
          If qtApp.launched True then   
              qtApp.Launch   
          End If  
          qtApp.Visible = True   
          qtApp.Open "F:\Jenkins_Jobs\OnCall_Sanity_Automation\DriverScript\Sample",  False   
          Set QTPTest=qtApp.Test    
          QTPTest.Run 'Run the Test QTPTest.Close   
          qtApp.quit
          Set qtApp = Nothing 
      else
          MsgBox "Name not exists"
      End If
  Next
  </code></pre>
  
  <p>Please help me to resolve the issue.</p>
  
  <p>Thanks, Amar</p>
  
  <p><strong>Update</strong>  </p>
  
  <p>Console Output:  </p>
  
  <blockquote>
    <p>Building in workspace C:\Program Files
    (x86)\Jenkins\workspace\Excel_Test [Excel]<br>
    $ cmd /c call C:\WINDOWS\TEMP\jenkin02.bat (C:\Program Files
    (x86)\Jenkins\workspace\Excel_Test>CScript )
    C:\Users\Admin\Desktop\Test_Sample.vbs" 
    C:\Users\Admin\Desktop\Test_Sample.vbs(3, 2) Microsoft Excel:
    Microsoft Excel cannot access the file
    C:\Users\Admin\Desktop\New.xlsx.   There are several possible reasons:
    ** The file name or path does not exist.**   The file is being used by another program.   The workbook you are trying to save has the same
    name as a currently open workbook.</p>
  </blockquote>