All pastes #928126 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-04 20:40 UTC
rendered paste body
Sub ToString_Example() 

'The following example retrieves a list of links from the 

'"Simple Web Example" page, creates the FileSystemObject, 

'and uses the ToString method to write the test object (link) names (for example, 

'"banner" and "contents") and test object type (for example, "Frame") 

'to c:\Links.txt. 

 

Dim fso, ResultFile, oDesc 

'Get a collection of all Links in the "Simple Web Example" page 

Set oDesc = Description.Create 

oDesc("Class Name").Value = "Link" 

Set oLinkCollection = Browser("Simple XML Example from").Page("Simple Web Example").ChildObjects(oDesc) 

 

'Create the FileSystemObject 

Set fso = CreateObject("Scripting.FileSystemObject") 

Set ResultFile = fso.OpenTextFile("c:\Links.txt", 2, True) ' 2 = Open file for writing 

 

'Write to the file 

For i = 0 To oLinkCollection.Count - 1 

    ResultFile.Write oLinkCollection.Item(i).ToString & vbNewLine 

Next 

 ResultFile.Close 

 

End Sub