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

  • SEARCH
  • Home
  • 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 8592185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:41:45+00:00 2026-06-11T23:41:45+00:00

I currently import 12000+ xml files into an excel workbook using the following vba:

  • 0

I currently import 12000+ xml files into an excel workbook using the following vba:

Public Sub XMLIMport()

    Dim lngRow As Long
    Dim strXML As String
    Dim ct As Integer, XMLMap

    Const maxXMLDel = 1
    lngRow = 2

    Do While Cells(lngRow, 1) <> ""
        strXML = Cells(lngRow, 1)
        ActiveWorkbook.XMLIMport url:=strXML, _
        ImportMap:=Nothing, Overwrite:=False, _
        Destination:=Range("$B$" & lngRow)
        lngRow = lngRow + 1
        For Each XMLMap In ActiveWorkbook.XmlMaps
                  XMLMap.Delete
        Next
    Loop

End Sub

and then proceed to import the workbook sheet from excel into a table in access 2007. The import uses links to the server to download the individual files.

So in column A is the xml link and the macro places the xml data results in columns B, C, D, etc and proceeds to the next row and repeats the process for each file. But with so many files it takes quite some time before the process is finished. I have even included deleting xml maps to speed up the process, but Excel 2007 still takes quite awhile to finish the process (2hrs+).

Is this macro I guess for lack of a better word ‘optimized’ for what I am wanting or is there another way this should be done?

UPDATE: disabled screen updating but running into an error trying to delete the connections.

running the macro recorder I get the following for deleting some of the connections, but I am unsure how to add this to the above macro to make it delete the connection in addition to the xmlmap before proceeding to the next file.

Sub deleteconnection()
'
' deleteconnection Macro
'

'
    ActiveWorkbook.Connections("itemResponse").Delete
    ActiveWorkbook.Connections("itemResponse1").Delete
    ActiveWorkbook.Connections("itemResponse10").Delete
    ActiveWorkbook.Connections("itemResponse100").Delete
    ActiveWorkbook.Connections("itemResponse101").Delete
    ActiveWorkbook.Connections("itemResponse102").Delete
    ActiveWorkbook.Connections("itemResponse103").Delete
    ActiveWorkbook.Connections("itemResponse104").Delete
    ActiveWorkbook.Connections("itemResponse105").Delete
    ActiveWorkbook.Connections("itemResponse106").Delete
    ActiveWorkbook.Connections("itemResponse107").Delete
    ActiveWorkbook.Connections("itemResponse108").Delete
    ActiveWorkbook.Connections("itemResponse109").Delete
    ActiveWorkbook.Connections("itemResponse11").Delete
    ActiveWorkbook.Connections("itemResponse110").Delete
    ActiveWorkbook.Connections("itemResponse111").Delete
    ActiveWorkbook.Connections("itemResponse112").Delete
    ActiveWorkbook.Connections("itemResponse113").Delete
    ActiveWorkbook.Connections("itemResponse114").Delete
    ActiveWorkbook.Connections("itemResponse115").Delete
    ActiveWorkbook.Connections("itemResponse116").Delete
    ActiveWorkbook.Connections("itemResponse117").Delete
    ActiveWorkbook.Connections("itemResponse118").Delete
    ActiveWorkbook.Connections("itemResponse119").Delete

End Sub

EDIT: Trying to adding a deletion for connections using the following

Public Sub XMLIMport()

    Dim lngRow As Long
    Dim strXML As String
    Dim ct As Integer, XMLMap
    Dim QTable As QueryTables


    'Application.ScreenUpdating = False

    Const maxXMLDel = 1
    lngRow = 2

    Do While Cells(lngRow, 1) <> ""
        strXML = Cells(lngRow, 1)
        ActiveWorkbook.XMLIMport url:=strXML, ImportMap:=Nothing, Overwrite:=False, Destination:=Range("$B$" & lngRow)
        lngRow = lngRow + 1
        For Each XMLMap In ActiveWorkbook.XmlMaps
                  XMLMap.Delete
         Next
         For Each QTable In ActiveSheet.QueryTables
                  QTable.Delete

         Next
    Loop

    'Application.ScreenUpdating = True

End Sub

results in the connections being still left in the workbook and the first file is reinserted

  • 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-11T23:41:46+00:00Added an answer on June 11, 2026 at 11:41 pm

    To delete all connections:

    Dim Conn As Object        '* connection collection
    
    For Each Conn In ActiveWorkbook.Connections
    
        Conn.Delete
    
    Next Conn
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a nice script to import xml using powershell http://slash4.de/tutorials/Automatic_mediawiki_page_import_powershell_script Currently I don't
I'm currently trying to import about 10000 rows (from a CSV file) into an
currently, I used PHPExcel to import excel file, there is a function $cell->getCoordinate(); I
currently I have the following which parses a json api.. import simplejson import urllib2
I am currently using PIL. from PIL import Image try: im = Image.open(filename) #
I have some XML files that I do a weekly import from for one
So I have this need to import (currently) about 15k products. Each product has
Currently I'm trying to run this powershell script: Param ( $websiteName, $physicalPath ) import-module
I am having trouble with developing my Android application, I am currently using Eclipse
Thanks for the help. Currently I import in gae: from google.appengine.ext.webapp import template then

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.