Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Save As issue
#1
Solved: 10 Years, 9 Months, 1 Week ago
What is wrong with

Code:
objExcel.ActiveWorkbook.SaveAs (FilePath)

My code:


Code:
Public Function SaveOrSaveAsAndCloseExcelSheet (FilePath, objExcel)

'USE to Save or Save As and then Close an Excel sheet

sSourceFile = FilePath

Set objFso = CreateObject("Scripting.FileSystemObject")

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

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

objExcel.Visible = False
objExcel.DisplayAlerts = False

objExcel.Quit
Set objExcel=Nothing
Set objFso=Nothing
objExcel.Workbooks.Close()

End Function
Reply


Messages In This Thread
Save As issue - by mv8167 - 07-07-2011, 11:01 PM
RE: Save As issue - by rajpes - 07-07-2011, 11:20 PM
RE: Save As issue - by mv8167 - 07-08-2011, 04:35 AM
RE: Save As issue - by mv8167 - 07-08-2011, 09:43 PM
RE: Save As issue - by rajpes - 07-08-2011, 09:56 PM
RE: Save As issue - by mv8167 - 07-09-2011, 12:24 AM
RE: Save As issue - by mv8167 - 07-09-2011, 01:54 AM
RE: Save As issue - by rajpes - 07-09-2011, 08:02 AM
RE: Save As issue - by mv8167 - 07-11-2011, 08:51 PM
RE: Save As issue - by rajpes - 07-11-2011, 10:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Save or Save As not working for QTP 11 Nick 1 3,081 08-13-2011, 12:16 PM
Last Post: vaddevinod

Forum Jump:


Users browsing this thread: 1 Guest(s)