#1
|
|||
|
|||
What's wrong with my code?
My code seems to run perfectly in updating all links in my document that I run off my desktop. It takes about 10 seconds to run. When I email the form out to a user, the code takes a few minutes to run and seems to be looping. Why is that? Am I doing something wrong?
Code:
Private Sub CommandButton1_Click() Dim myRange Set myRange = Selection.Range Selection.WholeStory Selection.Fields.Update myRange.Select End Sub |
#2
|
||||
|
||||
Are you emailing out the form as a docm? CommandButton1_Click() is a fairly generic name for a macro. If the user already has a macro by that name defined on their system, it's likely they are running that macro instead of the one you sent them.
|
#3
|
||||
|
||||
There are no loops in the code, so the idea that it's looping is mistaken. However, you also mention updating links. Link update performance can be seriously affected by whether the updates are being done over a network. And, of course, if the path to the data is different on the user's PC, Word quite possibly won't be able to find the source find to do the updates from.
FWIW, the macro could be made much more efficient: Code:
Private Sub CommandButton1_Click() Application.ScreenUpdating = False With Activedocument .Fields.Update .PrintPreview .ClosePrintPreview End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Thanks for the help everyone. I'm slowly learning all of this in great part of everyone's input.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wrong hyphenation | NobodysPerfect | Word | 1 | 02-04-2014 05:46 AM |
Open With (Boy I did something wrong) | lostsoul62 | Word | 1 | 12-27-2011 07:29 PM |
Demo gone wrong | RyanNIF | Publisher | 1 | 10-19-2011 05:55 AM |
column break what am I doing wrong? | oaty | Word | 0 | 08-12-2010 10:15 AM |
PLEASE HELP-wrong formatting???? | bruce | Word | 10 | 04-10-2010 03:45 PM |