GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  QTP
Go To First  |  Previous Question  |  Next Question 
 QTP  |  Question 84 of 674    Print  
Hi

I am new to QTP Automation. Can anyone define a process or code to convert Excel data into xml format using QTP....

thanks in advance

Satya

  
Total Answers and Comments: 3 Last Update: July 18, 2008     Asked by: meattesting 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 03, 2006 00:00:29   #1  
dsharma Member Since: February 2006   Contribution: 59    

RE: Hi I am new to QTP Automation. Can an...

You wil have to first create FSO for Excel and then try following script.

Make sure the excel file mentioned is in place


set sh CreateObject( Scripting.FileSystemObject )
set exl CreateObject( Excel.Application )
exl.visible true

set wb exl.WorkBooks.Open( C:try_excel.xls )
set ws wb.Worksheets( Sheet1 )

ws.Activate

Dim operation

operation exl.ActiveSheet.Cells(Row 4).Value

msgbox operation


 
Is this answer useful? Yes | No
July 11, 2006 02:26:14   #2  
meattesting Member Since: June 2006   Contribution: 2    

RE: hi

Hi

Thanks for the reply..I have completed that stuff in another way.Now i need to compare the XML files.I need to featch Two folders/subfolders and compare the files from those sub folders/folders.I have done for comparsion of XML files but i need to write the result in the XML file.

I have tried out in the following way ...

Function CompareFolder_Files (FolderName1 FolderName2)

Dim fso1 FirstFolder f1 fc1 strTXT1 TextFile1 'For First Folder

Dim fso2 SecondFolder f2 fc2 strTXT2 TextFile2 'For Seconf Folder.

Dim strPath(100 ) strDest(100 )

Set Acutaldoc XMLUtil.CreateXML()

Set Excepteddoc XMLUtil.CreateXML()

Set fso1 CreateObject( Scripting.FileSystemObject )

Set fso2 CreateObject( Scripting.FileSystemObject )

Set FirstFolder fso1.GetFolder(FolderName1)

Set FirstFolder_Sub FirstFolder.SubFolders

Set SecondFolder fso2.GetFolder(FolderName2)

Set SecondFolder_Sub SecondFolder.SubFolders

Set fc1 FirstFolder.Files

Set fc2 SecondFolder.Files

i 1

For Each f1 in fc1

strPath(i) f1.path

Acutaldoc.Loadfile strPath(i)

strActualPath strPath(i)

i i+1
Next

i 1

For Each f2 in fc2

strDest(i) f2.path

Excepteddoc.Loadfile strDest(i)

strExceptedpath strDest(i)

i i+1
Next

i 1

For i 1 to fc1.count

Set Actualdoc XMLUtil.CreateXML()

Set Excepteddoc XMLUtil.CreateXML()

Set Actualdoc1 XMLUtil.CreateXML()

Set Excepteddoc1 XMLUtil.CreateXML()

Actualdoc1.Loadfile strPath(i)

Excepteddoc1.Loadfile strDest(i)

Msgbox Actualdoc1

Msgbox Excepteddoc1

Actualdoc.Load Actualdoc1.ToString

' Actualdoc.GetRootElement.ChildElements.Item(1).Namespace True

Excepteddoc.Load Excepteddoc1.ToString

'Excepteddoc.GetRootElement.ChildElements.Item(1).Namespace True


XMLres Actualdoc.Compare (Excepteddoc resultXML micXMLNone+micXMLAttributes+micXMLCDataSections+micXMLValues)

msgbox resultXML' (Error Namespace cannot be false)

Set result XMLUtil.CreateXML()

result.Load resultXML.ToString

result.SaveFile C:XMLResultResult.xml

If XMLres 1 then

msgbox Documents match

Else

msgbox Do not match :-(

End If

Next


End Function

Can Help me .....

I m stuck with the NameSpaces error...wating for u r reply ...


 
Is this answer useful? Yes | No
July 18, 2008 03:22:53   #3  
DiptiChaudhary Member Since: July 2008   Contribution: 2    

RE: Hi I am new to QTP Automation. Can anyone define a process or code to convert Excel data into xml format using QTP....thanks in advanceSatya
Hi........
i to want to convert the data from XL to xml or html with the help of QTP......
i think you did a similar stuf..........
can u plz help me out....
Looking forward for your positive response...
Regards dipti

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape