![]() |
|
#6
|
|||
|
|||
|
My apologies for that ... Here is the code for that macro: Code:
Sub Create_Reset_Variables()
With ActiveDocument.Variables
'When the userform opens up with a new document, these are the values displayed by default.
.Item("varAuth").Value = "None"
.Item("varProjNum").Value = "0"
.Item("varProjName").Value = "None"
.Item("varDefl").Value = 0
End With
FullDocumentUpdateFields
End Sub
Code:
Sub FullDocumentUpdateFields()
Dim pRange As Word.Range
Dim oShp As Shape
Dim iLink As Long
Dim TOC As TableOfContents
Dim TOF As TableOfFigures
Dim TOA As TableOfAuthorities
Dim strAlerts As String
strAlerts = Application.DisplayAlerts
Application.DisplayAlerts = wdAlertsNone
iLink = ActiveDocument.Sections(1).Headers(1).Range.StoryType
For Each pRange In ActiveDocument.StoryRanges
Do
pRange.Fields.Update
Select Case pRange.StoryType
Case 6, 7, 8, 9, 10, 11
If pRange.ShapeRange.Count > 0 Then
For Each oShp In pRange.ShapeRange
If oShp.TextFrame.HasText Then
oShp.TextFrame.TextRange.Fields.Update
End If
Next oShp
End If
End Select
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
Application.DisplayAlerts = strAlerts
For Each TOC In ActiveDocument.TablesOfContents
TOC.Update
Next TOC
For Each TOA In ActiveDocument.TablesOfAuthorities
TOA.Update
Next TOA
For Each TOF In ActiveDocument.TablesOfFigures
TOF.Update
Next TOF
lbl_Exit:
Exit Sub
End Sub
Quote:
In my first post I explained what I wanted the code to do ... Is there a specific part you'd like me to elaborate more on? |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Could somebody help me with the code of my VBA userforms(Combibox - saving - editing of data) | 19339 | Excel Programming | 2 | 09-14-2018 12:06 AM |
| Is it possible to have menubar in userforms | srinivasaru | Excel Programming | 3 | 03-22-2017 03:53 AM |
| using office icons on userforms controls | fraz627 | Excel | 0 | 05-02-2014 06:02 PM |
Multiple Userforms Displaying Different Content but Returning Same Content?
|
marksm33 | Word VBA | 1 | 02-24-2014 06:17 PM |
looping controls on userforms
|
Cbrehm | Excel Programming | 5 | 05-11-2011 02:53 AM |