Add todays date and version to your project and replace date and increment version by 1 when revising

Just created this to help me add current date and version # to artwork and when revising the artwork it changes the date to current date and increments the version by 1.

Sub UpdateDateAndVersion()
    Dim sDate As String
    Dim versionText As String
    Dim currentVersion As Integer
    Dim txtDateShape As Shape, txtVersionShape As Shape
    Dim foundDate As Boolean, foundVersion As Boolean
    Dim versionPrefix As String: versionPrefix = "Version "
   
    ' Format the current date
    sDate = Format(Now, "MMMM dd, yyyy") ' Adjust the date format as needed
   
    ' Attempt to find the last inserted date and version text objects
    Dim shp As Shape
    For Each shp In ActiveDocument.ActiveLayer.Shapes
        If shp.Type = cdrTextShape Then
            If InStr(1, shp.Text.Story, sDate) > 0 Then
                Set txtDateShape = shp
                foundDate = True
            ElseIf InStr(1, shp.Text.Story, versionPrefix) > 0 Then
                Set txtVersionShape = shp
                foundVersion = True
                ' Extract current version number
                currentVersion = Val(Mid(shp.Text.Story, Len(versionPrefix) + 1)) + 1
            End If
        End If
        If foundDate And foundVersion Then Exit For
    Next shp
   
    ' Update date and version text if found, otherwise insert new
    If foundDate And foundVersion Then
        txtDateShape.Text.Story = sDate
        txtVersionShape.Text.Story = versionPrefix & currentVersion
    Else
        ' Insert new date and version text, similar to your initial script
        ' For simplicity, reusing your logic here, adjust as necessary
        With ActiveDocument
            Set txtDateShape = .ActiveLayer.CreateArtisticText(0.286, 9.27, sDate, , , "Arial", 12)
            txtDateShape.AlignToPage cdrAlignHCenter
            Dim yPosVersion As Double
            yPosVersion = txtDateShape.PositionY - txtDateShape.SizeHeight - 0.2
            versionText = versionPrefix & "1" ' Start with version 1 if not found
            Set txtVersionShape = .ActiveLayer.CreateArtisticText(txtDateShape.PositionX, yPosVersion, versionText, , , "Arial", 12)
        End With
    End If
End Sub