View Single Post
 
Old 08-24-2017, 03:44 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

How about the following. Display varRef with a docvariable field.

Code:
Dim strRef As String
Dim vRef As Variant
    With ActiveDocument
        strRef = Left(.Name, InStrRev(.Name, ".") - 1)
        vRef = Split(strRef, "-")
        strRef = "RS-A589-" & vRef(1) & "-" & vRef(0) & "-" & vRef(2) & "-" & vRef(3)
        .Variables("varRef").Value = strRef
        .Fields.Update
    End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote