+ Reply to Thread
Results 1 to 3 of 3

VBA Clipboard Paste Values syntax

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    United States
    MS-Off Ver
    Office 16 / 365
    Posts
    14

    VBA Clipboard Paste Values syntax

    Hi everyone,

    The attached tool I have is a part of a larger tool, but is independent in its function.

    What it does: takes the input from a system (shown as 10 - Salaried, for example) and strips it of everything but the number (input in E22 and output in C22). It works great manually using Paste - Match Destination Formatting (taking the clipboard contents from my website and pasting from there), but I'm now looking to automate that process.

    Paste from CPS should aim to take the clipboard contents (which works when pasted manually) and paste into E22:E145 (however many entries there are). Once that pastes over, Copy Class #s copies the values from C22:C145 and pastes in another sheet (this button currently works).

    The issue I'm having is the VBA code associated with the Paste from CPS button. I have the following code implemented, but there is a debug error that I'm unsure how to proceed with. Error code is "Run-time error '1004': PasteSpecial method of Range class failed"

    For testing: This command works if it's in Excel (copying I22:J23), from my website (if pasted manually), but not if pasted automatically from the website (ideal). So, not sure what's happening there.

    Is there some limitation to VBA here that I'm missing (still getting used to syntax and flow here) or is there another piece to this puzzle in order to paste from the clipboard to emulate the manual paste command?

    Any help here would be greatly appreciated! Thank you!
    Attached Files Attached Files
    Last edited by yankeesrus07; 02-22-2017 at 04:13 PM. Reason: italics formatting

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Clipboard Paste Values syntax

    The code itself if fine as pasting data from the clipboard will work. The issue is probably with the source as you have already indicated.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Registered User
    Join Date
    11-09-2012
    Location
    United States
    MS-Off Ver
    Office 16 / 365
    Posts
    14

    Re: VBA Clipboard Paste Values syntax

    Thanks for your response.

    I would imagine it would be the source, then. Was just surprised because a manual paste command spits out the clipboard contents. Not sure why there's a limitation regarding the VBA portion of it.

    Would there be a method of coding to force the clipboard contents into a specified string value (as a middle man)? From there, it would then paste the contents of that string value. Just throwing ideas at this point, not particularly sure of the syntax surrounding that (or whether it would function in use).

+ 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. Paste values of a formula cell from a button to my clipboard?
    By tonyridino in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-25-2015, 06:17 PM
  2. vba syntax to paste clipboard content
    By VINOTHBASKRAN in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2014, 08:50 AM
  3. Replies: 2
    Last Post: 03-05-2013, 07:52 AM
  4. Paste as values syntax question
    By Bishonen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-04-2012, 03:33 AM
  5. Paste Unique Values from Clipboard
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-27-2006, 11:45 AM
  6. Paste Special Values Syntax
    By L. Howard Kittle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2006, 05:10 PM
  7. [SOLVED] Store clipboard before "vba do cut&paste" then recover stored information to clipboard?
    By Marie J-son in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-08-2006, 02:00 AM

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