Dim objXL, WB, strMessage, targetPath
On Error Resume Next
 
Set objXL = GetObject(, "Excel.Application")
targetPath =f_GetTempUserLocation&"\"
 
For Each aWorkbook In objXL.Workbooks
                aWorkbook.Activate      
                
                'To skip file overwrite prompt
                objXL.DisplayAlerts = False
                
                'Save in current location
                'aWorkbook.Save
                set sheet1 = aWorkbook.Worksheets(1)
                msgbox Sheet1.cells(2,2)
                'SaveAs in another location
                aWorkbook.SaveAs targetPath & aWorkbook.Name
                
                objXL.DisplayAlerts = True
    
                'Save/As only not saved files
    'If aWorkbook.Saved = False Then
                                
    'End If
Next
 
objXL.ActiveWorkbook.Close
objXL.Application.Quit
 

 
 
 
 
 
 
Function f_GetTempUserLocation()
Const WindowsFolder = 0

Const SystemFolder = 1

Const TemporaryFolder = 2

Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")

Dim tempFolder: tempFolder = fso.GetSpecialFolder(TemporaryFolder)

f_GetTempUserLocation = tempFolder    
End Function

On Tuesday, October 1, 2013 11:04:43 PM UTC+5:30, surabhi wrote:
>
> hi all,
>
> Can anyone suggest or have any code that will open the existing Excel 
> sheet "EXCEL1"; create a duplicate sheet of this and do a save as "Excel2"? 
> it is little urgent.
>
> Thanks
>

-- 
-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

--- 
You received this message because you are subscribed to the Google Groups "QTP 
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to