none
selection.insertfile in Word 2013 is slow RRS feed

  • Question

  • Hello,

    We have VBA code that builds documents dynamically by inserting small snippets of code using selection.insertfile method.

    When we upgraded from Word 2003 to Word 2013, the code running to insert the files is significantly slower. We have done performance tests on a dozen documents and we're seeing the documents are taking 4-5 times longer to build.

    Sometimes we can see a "...downloading file..." message pop up as a file is being inserted; this happens when the document creation is being extremely slow.

    What might be different with the file insert functionality in Word 2013? Is there a particular setting that needs to be enabled or disabled to help speed this back up?

    Thanks,

    Dawn

    Thursday, July 30, 2015 10:14 PM

All replies

  • Hi Dawn

    Generally, macro execution has slowed with each version of Word and there's nothing, really to speed it up.

    But have you tested inserting these files as an end-user, to see whether/how much slower it is in 2013 (perhaps due ot network considerations) than in 2003?

    Have you tested whether storing and inserting these "snippets" as Building Blocks (AutoText) would be faster?


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 31, 2015 3:30 PM
    Moderator
  • Hi Dawn,

    Did the suggestion from Cindy work for you? I made a test with selection.insertfile in Word 2013, and I did not find obvious slow. I think you could test with the selection.insertfile in Word 2013 without other code to check whether it is caused by selection.insertfile.

    >> Sometimes we can see a "...downloading file..." message pop up as a file is being inserted; this happens when the document creation is being extremely slow.

    It seems that the file you want to insert was in the Internet. If so, I agree with Cindy, the speed of inserting file is also related with network speed, and I suggest you test with the local file to check whether it is related with the network speed.

    Best Regards,

    Eward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, August 3, 2015 8:02 AM
  • Thank you. 

    I will test inserting files locally, versus through the network and compare.

    I will let you know what I find.

    Dawn

    Monday, August 3, 2015 5:53 PM
  • Hello,

    Running the same code set, testing VBA code inserting files that are located on the network, versus files located locally (on the c:\ drive):

    On the Network, Word 2013 ran 35% slower than Word 2003

    On the C:\, Word 2013 ran 70% slower than Word 2003

    Comparing the 2013 running locally with 2003 running from the network, is still 14% slower.

    Overall, 2013 macro code runs quite a bit slower than 2003 macro code.

    Why is it that each version release of Word macros runs slower than the previous? Is there nothing that can be done to optimize the code (configuration, etc).

    Autotext does execute faster (still slower in 2013 than 2003), but we have 10,000+ word files that are dynamically inserted via VBA and converting them to autotext would be a monumental task.

    We were hoping for an overall solution.

    Any suggestions?

    Thank you!

    Dawn

    Tuesday, August 4, 2015 4:09 PM
  • Hi Dawn,

    Did your Word 2013 and Word 2003 install in the same PC or different PC? How did you get the value of “35%” and “70%”? Do you add timestamp to the code and run the code?

    I suggest you insert the file manually to check whether the slower is caused by code.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, August 5, 2015 7:13 AM