473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

VBA Macro XML receiving Run-time error '91': Object variable or With block variable n

I was write code for Excel VBA XLM database values write into text file. when I using without any special characters XML values parsed into their text file without any issues but when I using special characters XML cannot parse special characters (&,- etc) error getting on my macro page. Anyone have any ideas on how to resolve this?

My code :-
Expand|Select|Wrap|Line Numbers
  1. Dim XDoc1 As Object
  2. Dim XHTML1 As IHTMLElement
  3. Dim XURL1 As String
  4. Dim CustomerName1 As String
  5.  
  6. Set XDoc1 = CreateObject("MSXML2.DOMDocument")
  7. XDoc1.async = False: XDoc1.validateOnParse = False
  8. XDoc1.Load ("http://www.beamon.com/windows_application/macro1.php" + "?Id="   + Sheets(1).Range("D2"))
  9. Set Lists = XDoc1.DocumentElement
  10. Set getFirstChild = Lists.FirstChild
  11. Set getCustomerName1 = Lists.ChildNodes(1)
  12. Set getEnglname = Lists.ChildNodes(2)
  13. Set getTopCustomer = Lists.ChildNodes(3)
  14. Set getTopAssy = Lists.ChildNodes(4)
  15. Set getTopFab = Lists.ChildNodes(5)
  16. Set getTopnew1 = Lists.ChildNodes(6)
  17. Set getTopnew2 = Lists.ChildNodes(7)
  18. Set getTopside = Lists.ChildNodes(8)
  19. Set getBotCustomer = Lists.ChildNodes(9)
  20. Set getBotAssy = Lists.ChildNodes(10)
  21. Set getBotFab = Lists.ChildNodes(11)
  22. Set getBotnew1 = Lists.ChildNodes(12)
  23. Set getBotnew2 = Lists.ChildNodes(13)
  24. Set getBotside = Lists.ChildNodes(14)
  25.  
  26. Sheets(1).Range("T5") = getCustomerName1.text
  27. Sheets(1).Range("T6") = getFirstChild.text & Space(1) & getEnglname.text
  28. Sheets(1).Range("T7") = getTopCustomer.text
  29. Sheets(1).Range("T8") = getTopAssy.text
  30. Sheets(1).Range("T9") = getTopFab.text
  31. Sheets(1).Range("T10") = getTopnew1.text
  32. Sheets(1).Range("T11") = getTopnew2.text
  33. Sheets(1).Range("T12") = getTopside.text
  34.  
  35. Sheets(1).Range("T13") = getBotCustomer.text
  36. Sheets(1).Range("T14") = getBotAssy.text
  37. Sheets(1).Range("T15") = getBotFab.text
  38. Sheets(1).Range("T16") = getBotnew1.text
  39. Sheets(1).Range("T17") = getBotnew2.text
  40. Sheets(1).Range("T18") = getBotside.text
  41. Columns("T").EntireColumn.Hidden = True
  42. Set XDoc1 = Nothing
  43.  
  44. Dim rng As Range
  45. Dim c As Range
  46. Dim FF
  47.  
  48. FF = FreeFile
  49. Open "C:\Area ratio\etch.txt" For Output As #FF
  50. Set rng = Range("T5:T18")
  51. For Each c In rng.Cells
  52. Write #FF, c.Value
  53. Next c
  54. Close #FF
Apr 5 '17 #1
0 974

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Peter | last post by:
I have a program which was working fine. In it a function works out the number of .jpg files in a specified folder. I then realised that I needed to make sure the folder exists first & added the...
3
by: Richard Hollenbeck | last post by:
I've marked the line in this subroutine where I've been getting this error. It may be something stupid but I've been staring at this error trying to fix it for over an hour. I'm pretty sure the...
3
by: christine0207 | last post by:
hi Can anyone help to debug this problem? the error msg is run-time error '91': object variable or with block variable not set. here is my source code: Option...
2
by: daruse712 | last post by:
Hi there, I'm writing a function to search through a calendar to find any conflicting meeting times for the appointment recently recieved. Heres the code: Private Function isConflict(appt As...
4
by: sahitya sidda | last post by:
"Error 91: object variable or with block variable not set" I am getting the above error while retrieving the index of selected row in listview. Please help me out Private Sub...
8
by: cloh | last post by:
Thanks to all the people who reply so promptly to my questions! I have another one related to the form I am working on. When I try to call this function from another, I get the "Object variable or...
2
by: akaess | last post by:
Hey everybody I am currently trying to merger data from a form in MS access but it keeps giving me the error 91: Object variable or with block variable not set. could somebody please look at the code...
3
by: KChilingulo | last post by:
I've database in MS Access so when I try to input a record on the window which is applicable fot the receipts to be entered am getting this message. Would you assist as am stuck on this issue
2
by: Brad Nerbovig | last post by:
I am getting this error when connecting to an Excel file from Access 2010. The weird thing is, if I click on okay when the routing fails, and then run it again it works just fine. In fact, if I run...
0
by: sukh13 | last post by:
I am getting Run time error 91 in below ** area.I couldn't figure it out where is the problem. What i try is, to avoid to enter duplicate pin number. Public Function Custom_PIN(ByVal TableName As...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.