I used to have a document in Lotus Notes that had a table with a "Press When Complete Button" in the last cell of row in the table.
Once clicked, the Users Name, Date and Time would replace the button in the table. (All part of a audit trail)
Is there anyone in here that can assist me it transferring this to Word.
I have got as far as creating the button, I now need to program it - bit with next to NO VB experience, I am stuck.
Option Explicit
Sub Test()
'Add a command button to a new document
Dim doc As Word.Document
Dim shp As Word.InlineShape
Set doc = Documents.Add
Set shp = doc.Content.InlineShapes.AddOLEControl(ClassType:="Forms.CommandButton.1")
shp.OLEFormat.Object.Caption = "Press When Complete"
'Add a procedure for the click event of the inlineshape
'**Note: The click event resides in the This Document module
Dim sCode As String
sCode = "Private Sub " & shp.OLEFormat.Object.Name & "_Click()" & vbCrLf & _
" MsgBox ""You Clicked the CommandButton""" & vbCrLf & _
"End Sub"
doc.VBProject.VBComponents("ThisDocument").CodeModule.AddFromString sCode
End Sub
Sub Button1_Click()
'
' Button1_Click Macro
'
'
Dim strUserName As String, strDate As String, strTime As String
strUserName = Application.UserName
strDate = Date
strTime = Time
MsgBox "User: " & strUserName & ", Date: " & strDate & ", Time: " & strTime, , "Button Clicked"
End Sub