title: How to save a csv file through an lotusscript agent
body: <p>I have a lotusscript agent which needs to move the contents of a cell in excel sheet(a csv file) to another cell. Following is the piece of code:</p>
  
  <pre><code>Dim xlApp As Variant, xlwb As Variant, xlsheet As Variant
  Set xlApp = CreateObject ( "Excel.Application" )
  Set xlwb = xlApp.Workbooks.Open(StrFilePath) 'strFilePath is the path to csv file
  Set xlsheet = xlwb.Worksheets(1)
  'Logic to check necessary cells in the excel sheet goes here...
  'Following two lines move the contents from (p,1) to (1,n)
  xlsheet.cells(1,n).value = xlsheet.cells(p,1).value
  xlsheet.cells(p,1).value = ""
  </code></pre>
  
  <p>Now the problem arises when I'm trying to save this csv file after moving the contents.
  I have used the below line to save the file:</p>
  
  <pre><code>xlwb.SaveAs(StrFilePath)
  </code></pre>
  
  <p>This method does not return any error. Yet the file doesn't get saved.</p>
  
  <p>Then I have also tried using the below line to save the file:</p>
  
  <pre><code>xlApp.activeworkbook.SaveAs(StrFilePath)
  </code></pre>
  
  <p>This method returns "Automation object error".</p>
  
  <p>The file is not getting saved by either of the methods. At this point, the agent is not able to execute further. </p>
  
  <p>The agent then needs to move this file from the path <code>StrFilePath</code> to another directory using the <code>FileCopy</code> statement. At this point, the agent throws the "Permission denied" error.</p>
  
  <p>The file is present in a directory in the D disk drive on the server.
  The agent also has been given "Allow restricted operations with full administration rights".</p>
  
  <p>Could someone please let me know what is the correct way to save this csv file and how to provide the necessary permissions for the file to be saved?</p>
  
  <p>Thanks!</p>