C screenupdating word
While Excel will set this back to True whenever focus is passed back to Excel (your macro finishes) in most cases, it pays to play it safe and include the code at the end.
You may even find in some cases that Screen Updating is set back to true before your recorded macro completes.
By setting Screen Updating to False at the Start of the macro, you will not only stop the constant screen flickering associated with recorded macro, but also greatly speed up the execution of the macro.
The reason it speeds up code is because Excel no longer needs to repaint the screen whenever it encounters such commands as Select, Activate, Large Scroll, Small Scroll and many others. Screen Updating=False should be placed at the Start of your macro like shown below Note how we have set the Screen Updating back to True on completion.
File Dialog(mso File Dialog File Picker) If doc To Open.
Range Dim o Frm As frm Progress Dim Portion Done As Double On Error Go To Err_Exit str Text To Insert = "Annual bonus rates for the last five years" str Text To Find = "Discharge Pack" Set doc To Open = Application.
Go To What:=wd Go To Line, Which:=wd Go To Absolute, Count:=1 Cells.
The addition of the 'Do Events' line did change something, however.
Go To What:=wd Go To Line, Which:=wd Go To Absolute, Count:=1 Sheets("Zakelijke Offerte1").
Sub Insert Text() Dim Doc As Document, str Text To Insert As String, str Text To Find As String Dim i As Long, doc To Open As File Dialog, s Hght As Single Dim rng To Search As Word.
Remove the line indicated to search for every instance.
The error 4605 seems to be gone, now that I've removed the 'hide cells' lines.