Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with SaveAs method
#1
On my SaveAs line, I get a Run Error of :

SaveAs method of Workbook class failed

Function file: O:\QTP Tests\NightlyRegressionTesting\Tests\LibraryImageAccessFunctions.qfl
Line (1250): " objExcel.ActiveWorkbook.SaveAs(FilePath) 'Use the SaveAs method if the file has never been saved before"

My code:

Code:
Public Function SaveOrSaveAsExcelSheet (FilePath, objExcel) Set objFso = CreateObject("Scripting.FileSystemObject") bFileExist = objFso.FileExists(FilePath) objExcel.Visible = True objExcel.DisplayAlerts = False If Not bFileExist Then objExcel.ActiveWorkbook.SaveAs(FilePath) 'ERROR ON THIS LINE Else objExcel.ActiveWorkbook.Save End If objExcel.DisplayAlerts = True objExcel.ActiveWorkbook.Close objExcel.Quit Set objExcel=Nothing Set objFso=Nothing End Function

Any ideas on why?

thx
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is a Method in QTP and how many types are method r there in QTP? vidyabr 1 4,889 07-28-2008, 02:14 PM
Last Post: surya_7mar

Forum Jump:


Users browsing this thread: 1 Guest(s)