Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 10-23-2018, 06:25 AM
Wojix Wojix is offline Userforms and DDE Windows 7 64bit Userforms and DDE Office 2010 64bit
Novice
Userforms and DDE
 
Join Date: Apr 2018
Posts: 8
Wojix is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
You didn't supply the macro called Create_Reset_Variables ...

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
Also, here is the code for the FullDocumentUpdateFields macro:


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:
Originally Posted by Guessed View Post
Get rid of the Set field - you can add a line in the Excel code to write that value into the Word document
Which Set field are you referring to?


Quote:
Originally Posted by Guessed View Post
Also disable the AutoNew macro until you can describe to us what you actually want that code to do.
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?
Reply With Quote
 



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
Userforms and DDE Multiple Userforms Displaying Different Content but Returning Same Content? marksm33 Word VBA 1 02-24-2014 06:17 PM
Userforms and DDE looping controls on userforms Cbrehm Excel Programming 5 05-11-2011 02:53 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft