+ Reply to Thread
Results 1 to 6 of 6

copy to clip board only visible text boxes from user form

  1. #1
    Registered User
    Join Date
    05-11-2014
    MS-Off Ver
    Excel 2003
    Posts
    36

    copy to clip board only visible text boxes from user form

    hi guys,

    hope you can help. its been beating me for weeks

    i have a user form where people fill in data into text boxes. some text boxes remain hidden if the user does not need to fill in the requested field. but when the command button is submitted all text boxes hidden or otherwise are copied to clip board.

    Does any one know the vba in order for only visible text boxes to be copied to clip board. i was thisnking of some sort of if statement around the vba to copy to clip board but nothing i use works.

    I really hope someone can help

    Thanks in advance

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: copy to clip board only visible text boxes from user form

    Can you post your current code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-11-2014
    MS-Off Ver
    Excel 2003
    Posts
    36

    Smile Re: copy to clip board only visible text boxes from user form

    at the moment i am using this to copy all text boxes to the clip board

    Private Sub CommandButton1_Click()


    Dim DataObj As New MSForms.DataObject
    Dim STR1 As String

    STR1 = A0 + vbCrLf + A1 + vbCrLf + A2 + vbCrLf + A3 + vbCrLf + A4 + vbCrLf + A5 + vbCrLf + A6 + vbCrLf + A7 + vbCrLf + A8 + vbCrLf + A9 + vbCrLf + A10 + A11 + vbCrLf + A12 + vbCrLf + A13 + vbCrLf + A14 + vbCrLf + A15 + vbCrLf + A16 + vbCrLf + A17 + vbCrLf + A18 + vbCrLf + A19 + vbCrLf + A20 + vbCrLf + A21 + vbCrLf + A22 + vbCrLf + A23 + vbCrLf + A24 + vbCrLf + A25 + vbCrLf + A26 + vbCrLf + A26 + vbCrLf + A28 + vbCrLf + A29 + vbCrLf + A30 + vbCrLf + A31 + vbCrLf + A32 + vbCrLf + A33 + vbCrLf + vbCrLf + A34 + vbCrLf + A35 + vbCrLf + A36 + vbCrLf + A37 + vbCrLf + A38 + vbCrLf + A39 + vbCrLf + A40 + vbCrLf + A41 + vbCrLf + A42 + vbCrLf + A43 + vbCrLf + A44 + vbCrLf + A45
    With DataObj
    .SetText STR1
    .PutInClipboard


    End With

    Unload UserForm10

    MsgBox "Notepad copied to clip board"

    End Sub


    Sorry not sure if this is the format you are after i am quite new to this forum

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: copy to clip board only visible text boxes from user form

    Are A0, A1 etc the textboxes?

  5. #5
    Registered User
    Join Date
    05-11-2014
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: copy to clip board only visible text boxes from user form

    yes they are. sorry i should have made that clear because the user form has different pages i labelled text boxes on each page different letters as identifiers.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: copy to clip board only visible text boxes from user form

    Try this.
    Please Login or Register  to view this content.
    PS Can you add code tags when posting code?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Any way to double click on a row number and have it copy that row to the clip board?
    By Albertsonsmowing in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2012, 11:14 AM
  2. Text field visible property on user form
    By JChandler22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2010, 02:44 PM
  3. Vba copy to clip board
    By eddbod in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2009, 12:14 PM
  4. [SOLVED] Sum selected Range and copy to clip board
    By Dewey in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-11-2006, 06:40 AM
  5. Copying Text to Clip Board Using a Macro
    By robertguy in forum Excel General
    Replies: 3
    Last Post: 02-18-2005, 10:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1