Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Save Excel file
#4
Not Solved
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

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.
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,586 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)