+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20

Thread: Save VBA Variable to Clipboard

  1. #16
    Registered User
    Join Date
    04-23-2004
    Location
    Washington State
    MS-Off Ver
    Whatever the government has on my computer
    Posts
    43

    Re: Save VBA Variable to Clipboard

    so I guess this brings me back to my original question... Is there a way to save the variable to the clipboard other than placing it in a cell and do the ole automated copy and paste routine?

    Thanks for sticking with me on this.
    Janos S. Vamos FC1 (X-DS)
    US Navy
    Xerox Tech
    Advance Combat Direction System Tech
    DD973 Computer/Peripheral Tech
    Snap II Tech
    MWR Leading Petty Officer
    Corrections Officer
    A man with many hats




    There are only 10 kind of people in this world. Those that understand Binary and those that don't...

  2. #17
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,979

    Re: Save VBA Variable to Clipboard

    Hello Janos,

    Does this site allow you to post HTML code? A lot of sites don't for security reasons.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #18
    Registered User
    Join Date
    04-23-2004
    Location
    Washington State
    MS-Off Ver
    Whatever the government has on my computer
    Posts
    43

    Re: Save VBA Variable to Clipboard

    So I went back to tlafferty's thread to try it again.... For some reason this time it worked which is really weird because I added the lines verbatum and I kept getting an object define error... This time it's working like a charm... The only thing I can think of is that it wa getting hung up after I already had an error the first time I tried it.. After closing the program and restarting it (a few days later I might add), it is now running like a champ.... Sometimes I hate computers. Especially when they make you look like the fool..

    Well this I think this is fully solved now.... Thanks everyone for your inputs.

    Quote Originally Posted by tlafferty View Post
    Added a couple of lines to your code:
    Sub Createcode()
    Dim DataObj As New MSForms.DataObject
    
    Range("A1").Select
    i = 0
    C = 0
    
    Do
    If ActiveCell.Offset(0, i).Value = "" Then GoTo A
    i = i + 1
    Loop
    
    A:
    Do
    If ActiveCell.Offset(C, 0).Value = "" Then GoTo B
    C = C + 1
    Loop
    
    
    B:
    i = i - 1
    C = C - 1
    Ti = 0
     
    CD = ""
    MsgCode = CD
    
    MsgBox ("Your code has been generated.  Just go to where you want to post it and select Paste.")
    DataObj.SetText CD
    DataObj.PutInClipBoard
    End Sub
    Janos S. Vamos FC1 (X-DS)
    US Navy
    Xerox Tech
    Advance Combat Direction System Tech
    DD973 Computer/Peripheral Tech
    Snap II Tech
    MWR Leading Petty Officer
    Corrections Officer
    A man with many hats




    There are only 10 kind of people in this world. Those that understand Binary and those that don't...

  4. #19
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,979

    Re: Save VBA Variable to Clipboard

    Hello Janos,

    When I was a DS in the Navy, I had a rubber mallet in my tool box. Just for situations like this one.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #20
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Save VBA Variable to Clipboard

    Despite the mallet you probably overlooked my suggestion in post #12, which does everything (reading & writing, no clipboard needed) in 1 go.



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0