none
Process delaying due to insertion of text box on word 2010 RRS feed

  • Question

  • Hi,

    For i = 1 To 500
       ActiveDocument.Shapes.AddTextbox msoTextOrientationHorizontal, 5, 5, 100, 72
    Next

    The above is the code, which i was using in WORD 2007 and it took only few seconds to complete the process(Adding Textboxes) but

    when i am using the same code in WORD 2010 it took 2 to 3 minutes. I am not able to find the root cause for the delay.

    Please help me.


    Monday, August 14, 2017 1:59 PM

All replies

  • I ran the following in Word 2010. Execution took less than 1 second:

    Sub AddTextBoxes()
    Application.ScreenUpdating = False
    Dim i As Long, eTime As Single
    ' Start Timing
    eTime = Timer
    
    For i = 1 To 500
      ActiveDocument.Shapes.AddTextbox msoTextOrientationHorizontal, 5, 5, 100, 72
    Next
    
    ' Calculate elapsed time
    eTime = (Timer - eTime + 86400) Mod 86400 ' Just in case execution time spans midnight
    MsgBox "Execution took " & Format(eTime / 86400, "hh:mm:ss")
    
    Application.ScreenUpdating = True
    End Sub

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Monday, August 14, 2017 11:41 PM
  • Hi,

    I cannot use Word 2007, so I've tried in Word 2010 and 2016 (on two different computers) using the same code you provided. (add  one line before it: Application.ScreenUpdate = False)
    And could reproduce your issue.

    Word 2010 32-bit (desktop, Windows 10): it took one minute (00:01:04)
        

        

    Word 2016 32-bit (laptop, Windows 10): it took three minute (00:03:00)
        

    My conclusion:
      I strongly recommend to send a feedback to  Word User Voice:

    Welcome to Word's Suggestion Box!
    https://word.uservoice.com/

    Best regards,

    Ashidacchi


    • Edited by Ashidacchi Tuesday, August 15, 2017 1:08 AM
    Tuesday, August 15, 2017 1:07 AM
  • I strongly recommend to send a feedback to  Word User Voice


    As I said more than 1 hour before you posted, the code takes less than 1 second to execute for me (Word 2010 on a Win 10 laptop), so sending the OP off to UserVoice is pointless - especially given that Word 2010 is no longer receiving mainstream support (since October 2015). The problem is most likely caused by interference from other software.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Tuesday, August 15, 2017 4:33 AM
  • As I said more than 1 hour before you posted, the code takes less than 1 second to execute for me (Word 2010 on a Win 10 laptop), so sending the OP off to UserVoice is pointless - especially given that Word 2010 is no longer receiving mainstream support (since October 2015). The problem is most likely caused by interference from other software.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Hi Paul Edstein,

    I tried using your code in Word 2016 on a Win 10, laptop.
    It took just one minutes.
          

    And tried the same in Word 2016 on a Win 10, desktop.
          
    Don't you think it is slow?
          cf. In Word 2010 on the same desktop
                

    Regards,

    Ashidacchi

    P.S.
      I tried in Excel 2016.  It took zero second.
          
    Private Sub btn_AddTextBox_Click()
        Application.ScreenUpdating = False
        Dim i As Long, eTime As Single
        ' Start Timing
        eTime = Timer
        ' ---
        For i = 1 To 500
            ActiveSheet.Shapes.AddTextbox msoTextOrientationHorizontal, 20, 50, 100, 72
        Next
        ' --- Calculate elapsed time
        eTime = (Timer - eTime + 86400) Mod 86400 ' Just in case execution time spans midnight
        MsgBox "Execution took " & Format(eTime / 86400, "hh:mm:ss")
        Application.ScreenUpdating = True
    End Sub
    
      Word would be inferior to Excel as for adding shapes, I think.
    • Edited by Ashidacchi Tuesday, August 15, 2017 6:35 AM
    Tuesday, August 15, 2017 6:21 AM
  • As I have said repeatedly - the code takes less than 1 second to execute for me (Word 2010 on a Win 10 laptop). If your results are not comparable, perhaps you have some other issue with your system - as I already suggested.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Tuesday, August 15, 2017 7:39 AM
  • To macropod,

      I've tried in several computers (OS: Windows 7, 10) and several version of Word (2007, 2010, 2013, 2016). and found all of them work fine, they take less than 1 second. 

      I don't know why issue has disappeared in two days (15-16, Aug).
      I updated "WinaeroTweaker" from 0.7.3 to 0.8.0. and updated "paint.net" to 4.0.17 in all my computers, and uninstalled MS-Office 2007 in one computer.
      (I've done nothing like DISM, SFC, or TroubleShooter.) 

    To gosoftwareprocurement19_112012,

      How is your issue?  Will you replace older Word to the newest 2016?
      I want to hear from you.

    Regards,

    Ashidacchi

    Wednesday, August 16, 2017 8:08 AM
  • Hi,

    I have tried in word 2013 with the code you have provided, It took 61 seconds(1 minute).

    We have tried all the versions of word which include 2010,2013 and 2016, issue remains the same. Only for word 2007 it takes 1 sec. We do not have any performance issues in our windows 7 system. 

    Could you please provide a solution.

    Thanks.

    Thursday, August 17, 2017 2:49 PM
  • The solution is to fix whatever else you have installed on those systems that is interfering with the process. As has been amply demonstrated by both me and Ashidacchi Hokusosha, without such interference the code can complete its processing in less than 1 second.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Thursday, August 17, 2017 9:20 PM
  • Hi Paul Edstein,

    As mentioned by you the Word 2016 itself took more than 1 minute. We have tried all the versions of the

    Word and we got the same result that means the process time takes more than 1 minute. Only the Word 2007 takes 1 second. What needs to be done to get the same result in all the versions of the Word ?

    Is there any service pack to be updated ? If so what is that ?

    To Ashidacchi : 

    Please see the above draft.

    Regards,

    Thursday, August 24, 2017 2:10 PM
  • I did not say Word 2016 took more than a minute. What I have said is that using Word 2010 - the same as you - on Win 10, the code takes less than 1 second to execute.

    In his post of Wednesday, August 16, 2017 8:08 AM, Ashidacchi Hokusosha confirmed my experience writing:
    I've tried in several computers (OS: Windows 7, 10) and several version of Word (2007, 2010, 2013, 2016). and found all of them work fine, they take less than 1 second

    My Word 2010 installation version is: 14.07.7184.5000 (32-bit).

    Perhaps your Office installation is faulty. Have you tried repairing the Office installation (via Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change > Repair)?

    Perhaps you have a faulty 3rd-party addin. Have you tried running Word in safe mode (i.e. hold down the Ctrl key while starting Word) to see if the performance improves?


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Thursday, August 24, 2017 2:41 PM