I think you are making it unnecessarily complicated.
When you do some work on a workbook you could save it then and there itself, no need to call a separate function to do just this job.Moreover you are calling it from another function!
I copied some code from some site, see if it helps you
-----
c u 2moro.
When you do some work on a workbook you could save it then and there itself, no need to call a separate function to do just this job.Moreover you are calling it from another function!
I copied some code from some site, see if it helps you
Code:
Dim objExcel, FilePath
FilePath="C:\Documents and Settings\gcr.GCRC-9A12FBD3D9\Desktop\gcr.xls"
Set objExcel=CreateObject("Excel.Application")
set objFso=CreateObject("Scripting.FileSystemObject")
objExcel.Visible=True
If Not objFso.FileExists(FilePath) Then
objExcel.Workbooks.Add
objExcel.Cells(1,1).value="QTP"
objExcel.ActiveWorkbook.SaveAs (FilePath)
Else
set myFile= objExcel.Workbooks.Open (FilePath)
Set mySheet=myFile.Worksheets("Sheet1")
mySheet.cells(1,1).value="QTP"
objExcel.ActiveWorkbook.Save
End If
objExcel.Quit
Set objExcel=Nothing
c u 2moro.