3 Replies - 3989 Views - Last Post: 31 August 2012 - 04:30 PM Rate Topic: -----

#1 pradeep1252  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-August 12

runtime error 91 object variable or with block variable

Posted 27 August 2012 - 11:58 AM

Hi all,

I am new to this VBA coding. I ve written a prog. to get the data from XML to Excel using macros. I am getting Runtime Error 91, even if i ve set object reference msxml4.dll.
The program runs on other Win 7 OS (Enterprise Edition). Its not working in my system (Win7 home premium).
I dono wats the problem is (Code Error/Adding ref. problem). Below is the code. Please help me in this asap. thanks in advance.

Private Sub Worksheet_Activate()
    Dim File As MSXML2.DOMDocument
    
    Set File = New MSXML2.DOMDocument
    File.Load ("C:\SomeXML.xml")
    Dim name As String
    name = File.SelectSingleNode("page").Attributes.getNamedItem("name").Text
    Cells(1, 1).Value = name
    MsgBox name
End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: runtime error 91 object variable or with block variable

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 463
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: runtime error 91 object variable or with block variable

Posted 28 August 2012 - 01:42 AM

perhaps the dll is missing. check if MSXML2 dll version is the same as the one added in your program.
Was This Post Helpful? 0
  • +
  • -

#3 pradeep1252  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-August 12

Re: runtime error 91 object variable or with block variable

Posted 28 August 2012 - 08:36 AM

I have added msxml6.dll for the reference. Still the same error..
and my VB version is 6.5.
Was This Post Helpful? 0
  • +
  • -

#4 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 571
  • View blog
  • Posts: 2,979
  • Joined: 19-May 09

Re: runtime error 91 object variable or with block variable

Posted 31 August 2012 - 04:30 PM

What line are you getting the error on?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1