Hi,

I have a function to read an XML document (stored in physical file system)and Put values in a another worksheet in a workbook.
I am able to open the workbook , but i need to access the worksheet (itz name is "PutDataSheet")

I have also created name range for the cells in the 'PutDataSheet" and need to refer them with the name while putting values.

I try to access the Worksheet as Source.WorkSheets("PutDataSheet") but throwz an error..

can u please tell how to access
the worksheet and also the namerange inside the worksheet to assign values.
Anywayz i am accessing the namerange as


Sheet.Range("PutDataSheet.Name") = node.SelectSingleNode("Name").Text

Below is the function for ur reference..

Function ReadXMLDocument(SheetName As String)

Dim xml_Doc As DOMDocument
Dim list As IXMLDOMNodeList
Dim node As IXMLDOMNode
Dim Sheet As Worksheet
Dim xlApp As Excel.Application
Dim Source As Workbook

Const MyDir As String = "c:\temp\"
Set xmlDoc = New DOMDocument
xmlDoc.Load "C:\temp\WellConfig.xml"

Set xlApp = New Excel.Application
Set Source = xlApp.Workbooks.Open(MyDir & "Summary.xls")
' Sheet = Source.Worksheets("PutDataSheet")


Set booklist = xmlDoc.DocumentElement.SelectNodes("WellConfig")
For Each node In list
Sheet.Range("PutDataSheet.Name") = node.SelectSingleNode("Name").Text
Sheet.Range("PutDataSheet.Operator") = node.SelectSingleNode("OperatingCompany").Text

Next

End Function

Thanks
Ranjani