M
Milo
I have a document that contains a button that the VBA code goes out to
a database and collects a unique number. Then it returns the number to
the document as a unique ID.
I am having an issue that when I copy the button over to a new document
that the VBA code is not being carried over. Is there a way to
automatically set this up to copy the code from one document to another
as I copy over the button?
My code is as follows:
Private Sub cmdGetNum_Click()
Dim oWebService As clsws_GetNum
Dim ctl As Control
Set oWebService = New clsws_GetNum
Dim strResult As String
strResult = oWebService.wsm_GetDocumentID("DM-1040E")
ThisDocument.txtSerialNumber = strResult
'ActiveDocument.Shapes(1).Visible = msoFalse
ThisDocument.cmdGetNum.Locked = True
ThisDocument.cmdGetNum.Enabled = False
ThisDocument.cmdGetNum.BackColor = &HFFFFFF
ThisDocument.cmdGetNum.ForeColor = &HFFFFFF
ThisDocument.cmdGetNum.BackStyle = fmBackStyleTransparent
ThisDocument.cmdGetNum.Caption = ""
End Sub
a database and collects a unique number. Then it returns the number to
the document as a unique ID.
I am having an issue that when I copy the button over to a new document
that the VBA code is not being carried over. Is there a way to
automatically set this up to copy the code from one document to another
as I copy over the button?
My code is as follows:
Private Sub cmdGetNum_Click()
Dim oWebService As clsws_GetNum
Dim ctl As Control
Set oWebService = New clsws_GetNum
Dim strResult As String
strResult = oWebService.wsm_GetDocumentID("DM-1040E")
ThisDocument.txtSerialNumber = strResult
'ActiveDocument.Shapes(1).Visible = msoFalse
ThisDocument.cmdGetNum.Locked = True
ThisDocument.cmdGetNum.Enabled = False
ThisDocument.cmdGetNum.BackColor = &HFFFFFF
ThisDocument.cmdGetNum.ForeColor = &HFFFFFF
ThisDocument.cmdGetNum.BackStyle = fmBackStyleTransparent
ThisDocument.cmdGetNum.Caption = ""
End Sub