Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Save Excel file
#1
Not Solved
My code below works except for the Save code. The SaveAs is good and works fine.

Can someone tell me what I need to change? thx

My code:
Code:
Public Function SaveOrSaveAsExcelSheet (FilePath)
Set objFso = CreateObject("Scripting.FileSystemObject")

'Check if file already Exists
bFileExist = objFso.FileExists(FilePath)

If  bFileExist Then            'SaveAs - Use the SaveAs  method as the file has been saved
   'objExcel.Workbooks.SaveAs (FilePath)
   objExcel.ActiveWorkBook.SaveAs (FilePath)
Else                            'Save - Use the Save method as the file has never been saved
   objExcel.ActiveWorkbooks.Save '(FilePath)
End If

objExcel.Visible = False
objExcel.DisplayAlerts = False
objExcel.Quit
Set objExcel=Nothing
Set objFso=Nothing

End Function
Reply


Messages In This Thread
Save Excel file - by mv8167 - 07-13-2011, 12:57 AM
RE: Save Excel file - by rajpes - 07-13-2011, 09:20 AM
RE: Save Excel file - by mv8167 - 07-13-2011, 07:48 PM
RE: Save Excel file - by rajpes - 07-13-2011, 10:58 PM
RE: Save Excel file - by mv8167 - 07-14-2011, 02:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to export the output value of a webedit object to a new excel file. mounika6677 1 1,584 04-14-2019, 05:18 PM
Last Post: mounika6677
  Access not saved excel file randhirsinghskhn 0 1,076 09-04-2018, 07:26 AM
Last Post: randhirsinghskhn
  dtLocalSheet empty even though excel file contains data cantorre 2 2,451 05-10-2017, 12:47 PM
Last Post: vidhi
  Extract and save a file from zip folder using VB Script karthicksri07 1 6,450 06-29-2016, 02:19 PM
Last Post: Ankesh
  Unable to Save a file in UFT 12.0.2 (Sequence contains more than one matching elemen) noeldsouza89 0 2,655 02-02-2015, 03:03 PM
Last Post: noeldsouza89

Forum Jump:


Users browsing this thread: 3 Guest(s)