Results 1 to 6 of 6

Thread: copy

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    17

    copy

    hi


    new to vba.


    if i have a textbox on a form in access (2000) and a button called 'copy', which command do i place behind this button to copy the contents of the textbox to my clipboard?

    ive tried .copy
    is it something to do with the do.cmd?

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: copy

    Try this:

    VB Code:
    1. Private Sub mnuCopy_Click ()
    2.    Clipboard.Clear
    3.    Clipboard.SetText Text1.SelText
    4. End Sub

    EDIT: Oh, just noticed that you wanted to use VBA. Not sure if that will work, try using HELP.
    Last edited by dglienna; Jul 23rd, 2005 at 07:54 PM.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: copy

    Nope, no Clipboard in Access. Your code is VB6 Dglienna. Only the Office Clipboard via the DoCmd method.
    VB Code:
    1. Private Sub BtnCopy_Click()
    2.     Me.txtTextBox.SelStart = 0
    3.     Me.txtTextBox.SelLength = Len(Me.txtTextBox.Text)
    4.     DoCmd.RunCommand acCmdCopy 'Copies the selected contents of txtTextbox control
    5. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    17

    Re: copy

    thanks people, that did it.
    :-)

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    17

    Re: copy

    how do i close a thread?

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: copy

    You can 'Resolve' a thread by going to the Thread Tools menu and selecting 'Resolve Thread'.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width