Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to identify the object reference to the existing(already opened) Excel sheet
#1
Not Solved
How to identify the object reference to the existing(already opened) Excel sheet in the Desktop and do"save as" of that file.I need to identify the existing(already opened) excel file in the desktop and do "save as" of that file in the designated folder. Please help me in getting VB Script code for this.

I have tried the below code, but its not working.

I am using Excel 2010.



Code:
Dim fso, FolderPath, objExcel, strPathExcel

      FolderPath = "c:\Excel_Reports"

      strPathExcel = FolderPath&"abcd.xls"

   ' Get instance of FileSystemObject.

   Set fso = CreateObject("Scripting.FileSystemObject")


    Set objExcel = GetObject("","Excel.Application")

      If not(fso.FolderExists(FolderPath)) then
       fso.CreateFolder (FolderPath)
          ' Create a new folder with the FileSystemObject object.
       End if

  objExcel.ActiveWorkbook.saveas strPathExcel
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
Reply


Messages In This Thread
How to identify the object reference to the existing(already opened) Excel sheet - by yogeesh - 09-12-2012, 10:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  not able to identify an webelement object Ninjukp 0 2,108 01-10-2018, 09:25 PM
Last Post: Ninjukp
  Pass reference to datatable into function smallsteve 2 1,898 09-28-2017, 09:18 PM
Last Post: smallsteve
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,597 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  Not Able to Identify Object during Recovery Scenario Phani 2 3,108 01-25-2016, 01:26 PM
Last Post: arunshuklainbox
  UFT 12.02 Compatibility for IE 11.0 : Fail to identify the defined Object Amruta_121 9 10,517 01-11-2016, 12:45 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)