Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2005
    Location
    Kent, England
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing back a domDocument (Office 2007)

    Can anyone help (please)?

    I have a domDocument (Function) that I need to load and pass back to a Sub. The Function is called with "Set domDocument = CreateDomDocument("c:tempUserProfile.xml")" and the code within the "CreateDomDocument" is:

    Set domDocument = CreateObject("msxml2.domDocument")
    domDocument.async = False
    domDocument.Load (pstrDataFile)

    When the Function has run and goes back to the Sub the domDocument is empty but before leaving the Function the domDocument has loaded. Does anyone know why the domDocument does not return to the Sub?

    I hope I'm making sense !!!

    Any help greatly appreciated.

    Cheers
    Jack

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Passing back a domDocument (Office 2007)

    If your function is called CreateDomDocument, you must assign a value to CreateDomDocument within the function.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2005
    Location
    Kent, England
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Passing back a domDocument (Office 2007)

    Hi Hans

    Have now resolved. I placed a "Set domDocument = CreateDomDocument("c:tempUserProfile.xml")" when calling the function and had to put a "Set" when sending the domDocument back.

    Set domDocument = CreateObject("msxml2.domDocument")
    domDocument.async = False
    domDocument.Load (pstrDataFile)
    Set CreateDomDocument = domDocument

    Regards
    Jack

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •