|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function strGetStamp(ByVal strChar As String, intCount As Integer)
' Procedure : strGetStamp
' Description: Obtain an encoded date stamp from a document.
' Copyright: Chris Greaves Inc.
' Inputs: A searchable character, a string length.
' Returns: The decoded numeric string.
' Assumes: Nothing
' Side Effects: None.
' Tested: By the calls shown below.
Dim intI As Integer
Dim intTemp As Integer
Dim strTemp As String
Selection.HomeKey Unit:=wdStory ' always use the start of document
With Selection.Find
.Text = strChar ' typically the space character (asc 032)
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
intI = 0
While intI < intCount And Selection.Find.Execute
intTemp = Selection.Font.size - intCount ' avoid zero-size fonts
If intTemp < 0 Then
intTemp = 0
End If
strTemp = strTemp & Trim(str(intTemp))
intI = intI + 1
Wend
strGetStamp = strTemp
'Sub TESTstrGetStamp()
' MsgBox strGetStamp(" ", Len(strPutStamp(" ", strNow("YYyymmdd"))))
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |