Command Button to copy multi-field data to clipboard

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create a command button that will copy the contents of the
name and address fields from current record onto the clipboard to paste into
Word. Can anyone provide an 'easy' solution, please?
 
Here's one way--create an invisible disabled control on your form, called say
txtFormAddr, whose Control Source is set to:

=[Address] & Chr(13) & [City] & ", " & [State] & " " & [Zip]

Chr(13) is a carraige return/line feed, and will place the last three fields
on a second line. Then the command button code is:

With Me!txtFormAddr
.Enabled = True
.Visible = True
.SetFocus
End With

Application.RunCommand acCmdCopy

' Reset focus to the command button, or anywhere else you like
Me!MyCommandButton.SetFocus
With Me!txtFormAddr
.Enabled = False
.Visible = False
End With

End Sub

Hope that helps. AND thanks for the suggestion; I can use this one too!
Sprinks
 
Back
Top