Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:42:46+00:00 2026-06-15T06:42:46+00:00

I created this macro and I get a Run-time error ’13’ at the line

  • 0

I created this macro and I get a Run-time error ’13’ at the line

Set objDomAttribute = objDomElement3.Attributes.setNamedItem(objDomDoc.createAttribute("Name4"))

My Excel file has 2727 rows. I tested it for fewer rows and it works perfectly, but for 2727 it doesn’t work. What should I do for solving that?

Option Explicit
Public Sub MakeXMLWithDom() 

Dim Q As String 
Q = Chr$(34) 

Dim objDomDoc As New MSXML2.DOMDocument60 

objDomDoc.LoadXML ("<?xml version=" & Q & "1.0" & Q & "encoding=" & Q & "utf-8" & Q & "?>") 

Dim objDomElement As MSXML2.IXMLDOMElement 
Dim objDomAttribute As MSXML2.IXMLDOMAttribute 
Dim nodeSet As MSXML2.IXMLDOMNodeList 

Set objDomElement = objDomDoc.createElement("Containers") 
Set objDomElement = objDomDoc.appendChild(objDomElement) 

 'finding the amount of rows in the excel
Dim numofrows As Long 
numofrows = Worksheets("EXAMPLE").Range("E1").Offset(Worksheets("EXAMPLE").Rows.Count - 1, 0).End(xlUp).Row 

Dim iRow As Integer 

Dim Value11 As Variant 
Dim Value12 As Variant 
Dim Value13 As Variant 

Dim objDomElement1 As Variant
Dim objDomElement2 As Variant
Dim objDomElement3 As Variant

For iRow = 10 To (numofrows + 1) 

    If Worksheets("EXAMPLE").Cells(iRow - 1, 5) = Worksheets("EXAMPLE").Cells(iRow, 5) Then 
        Value11 = Worksheets("EXAMPLE").Cells(iRow - 1, 11).Value & ", " & Worksheets("EXAMPLE").Cells(iRow, 11).Value 
        Value12 = Worksheets("EXAMPLE").Cells(iRow - 1, 12).Value & ", " & Worksheets("EXAMPLE").Cells(iRow, 12).Value 
        Value13 = Worksheets("EXAMPLE").Cells(iRow - 1, 13).Value & ", " & Worksheets("EXAMPLE").Cells(iRow, 13).Value 
    Else 
        Value11 = Worksheets("EXAMPLE").Cells(iRow, 11).Value 
        Value12 = Worksheets("EXAMPLE").Cells(iRow, 12).Value 
        Value13 = Worksheets("EXAMPLE").Cells(iRow, 13).Value 
    End If 

    If Worksheets("EXAMPLE").Cells(iRow, 5) <> Worksheets("EXAMPLE").Cells(iRow + 1, 5) And Worksheets("EXAMPLE").Cells(iRow, 3) <> "" And Worksheets("EXAMPLE").Cells(iRow, 5) <> "" Then 

        Set objDomElement1 = objDomElement.appendChild(objDomDoc.createElement("Data")) 
        Set objDomAttribute = objDomElement1.Attributes.setNamedItem(objDomDoc.createAttribute("Relevant")) 
        objDomElement1.Attributes.getNamedItem("Relevant").Text = "True" 

        Set objDomElement2 = objDomElement1.appendChild(objDomDoc.createElement("Info")) 

        Set objDomElement3 = objDomElement2.appendChild(objDomDoc.createElement("Part")) 
        Set objDomAttribute = objDomElement3.Attributes.setNamedItem(objDomDoc.createAttribute("Name1")) 
        Set objDomAttribute = objDomElement3.Attributes.setNamedItem(objDomDoc.createAttribute("Name2")) 
        Set objDomAttribute = objDomElement3.Attributes.setNamedItem(objDomDoc.createAttribute("Name3")) 
        Set objDomAttribute = objDomElement3.Attributes.setNamedItem(objDomDoc.createAttribute("Name4")) 

        objDomElement3.Attributes.getNamedItem("Name1").Text = Trim$(Worksheets("EXAMPLE").Cells(iRow, 5).Value) 
        objDomElement3.Attributes.getNamedItem("Name2").Text = Value11 
        objDomElement3.Attributes.getNamedItem("Name3").Text = Value12 
        objDomElement3.Attributes.getNamedItem("Name4").Text = Value13 

    End If 
Next iRow 

objDomDoc.Save ("c:\Example.xml") 
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:42:47+00:00Added an answer on June 15, 2026 at 6:42 am

    You say that Value13 in the Locals window shows as Value: Error 2015 and Type: Variant/Error. Well, okay, keep on investigating… Where does Value13 come from? Look in your Excel sheet on that line. I bet you’ll find a #VALUE! error there.

    So it’s a problem in your input data, not your code. Fix that and your problem will go away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created the following macro in elisp. It will set the value val to
I created this report in iReport Professional 4.5.1 and deployed it to JasperReports Server
I created this program: #include <iostream> #include <fstream> using namespace std; int main ()
I created this layout of successive text input fields, 1- Enter data into empty
I created this regular expression to validate names: ^[a-zA-Z0-9\s\-\,]+.\*?$ Is there a way add
I created this regex to match all words that start with @ in my
I created this example The remove function doesn't work, and I can't figure out
I have just created this table: create table dbo.OrderTypes ( ID smallint primary key
Ever since I created this Rails 3.2.3 project to use MiniTest, I have been
I've created this code, it is supposed to use wordpress metabox functionality to save

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.