How do I paste from clipboard to range using Excel VBA

MS EXCEL

    Next

  • 1. Create Export CSV file From Worksheet
    I would like to export my SAVES worksheet to a new spreadsheet. I would like to copy only Cells A25 to ZT65536. Path to new spreadsheet is: C:\Temp File Name is: SAVES.csv Please help with this tasks. Thanks,
  • 2. copy previous row down 5 rows
    Dim Cnt As Integer I'm try to insert 5 new rows, then copy the previous row down thru the next 5 rows. I'm have some problem in getting it to work. Need help. Thanks Range("A" & SheetEnd).Select Set CpyCel = EndCel.Offset(-1, 0) Cnt = 5 Do Until Cnt = 0 Selection.EntireRow.Insert Cnt = Cnt - 1 Loop RowStr = "" & CpyCel.Row & ":" & CDec(CpyCel.Row) Selection.EntireRow.Copy
  • 3. Refresh data
    I have a spreadsheet that will have 10 to 12 different data sources. Can I refresh all the data sources at once? or do I have to do them individually? Thanks in advance
  • 4. Beginner macro programming question
    Hi, I want to automate a simple task but know nothing about Excel macro programming. The macro recorder doesn't do what I want so I guess I need to write something. I'd like to perform the following steps in a macro: 1. Cut the contents of the current cell 2. Move over 3 columns to the right 3. Paste the cut data. 4. Move back over to the original position and 1 row down. That's it. I know, too easy? But I have no idea where to start. If someone can get me started I can take it from there for the rest of my macro needs. Thanks for any help Steve

How do I paste from clipboard to range using Excel VBA

Postby QmVlc2Fnb29k » Wed, 13 Oct 2004 03:07:02 GMT

I have just moved from Windows 2000 & Office 2002 (Old) to XP Pro and Office 
2003 (New).  The following statements work in the old version and also  in 
the new version when I step through the code using the de{*filter*}.  They fail 
when I try and run the macro in the new version.

Code:
Dim oSheet As Worksheet
' copy text to windows clipboard
oSheet.Paste
' error generated on the above stating "Paste method of Worksheet Class 
failed."

Re: How do I paste from clipboard to range using Excel VBA

Postby Dave Peterson » Wed, 13 Oct 2004 09:47:19 GMT

Did you set osheet to the correct sheet?

Was that sheet protected?

Any chance you ran something that cleared the clipboard?

maybe:

   if application.cutcopymode = false then
     msgbox "nothing to paste"
   else
     osheet.paste
   end if

If none of this helped, you'll have to include some more details.




-- 

Dave Peterson
 XXXX@XXXXX.COM 

Re: How do I paste from clipboard to range using Excel VBA

Postby QmVlc2Fnb29k » Fri, 15 Oct 2004 01:17:07 GMT

Yes, the cutcopymode returns false.  But when when it breaks, I step through 
the de{*filter*}, the data gets copied from the clipboard, so it is there.

The data is copied to the clipboard by using a DDE command to the 
"Bloomberg" application to copy the screen contents to the windows clipboard. 
 This instruction doesn't appear to notify the XP operating system that the 
data is there.  When it breaks and I step through, the XP operating system 
then is able to find the data on the clipboard.

I will try and access the API directly (although I haven't had to do this 
before) and debug.print as much info as I can to find this data when I run 
the VBA in real-time.  Thanks for your pointer and any more comments would be 
appreciated.  Thanks.






Re: How do I paste from clipboard to range using Excel VBA

Postby Dave Peterson » Fri, 15 Oct 2004 09:10:14 GMT

I've never used any DDE stuff.

I don't have any other guesses.






-- 

Dave Peterson
 XXXX@XXXXX.COM 

Re: How do I paste from clipboard to range using Excel VBA

Postby QmVlc2Fnb29k » Fri, 15 Oct 2004 21:55:04 GMT

It appears that the XP operating system required my Excel VBA aaplication to 
explicitly activate itself (although Windows 200 did not require this!).  The 
following code worked in XP:

AppActivate Application.Name
oSheet.Paste








Re: How do I paste from clipboard to range using Excel VBA

Postby Dave Peterson » Sat, 16 Oct 2004 08:10:40 GMT

Glad you posted back with your fix--now google knows!








-- 

Dave Peterson
 XXXX@XXXXX.COM 

Similar Threads:

1.AppleScript: Pasting Tab-Delimitated Text from Clipboard and Copying Range of Cells to Clipboard

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I have a clipboard containing tab-delimitated text that I would like to paste into an Excel spreadsheet. Excel use the data to perform calculations. I would then like to copy the multi-cell range of results into the clipboard.

How would I do this using AppleScript?

2.How do I disable Office Clipboard so Copy Paste uses traditional Windows Clipboard

3.Using VBA to load a picture and paste it to the clipboard

4.Excel VBA to Copy Paste Range X Times with the same spreadsheet

5.Paste range from Clipboard to Excel

Hi, I'm trying to use Clipboard from VBA in Excel 2000.
I can paste a single cell from the Clipboard using DataObject and related 
methods (MSForms 2.0 obj library) but I can't manage a range of cells.
After selecting and copy a range of cells from Excel to the Clipboard, with 
Clipboard Viewer I can see only one text string (from the last cell) and no 
formulas.

Should I try with WinAPI calls??? I searched Internet and I've found a tool 
(API Viewer) to look at the declares statement of a DLL, i.e.:
Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As Long
but I've never used it before.
I'd like to do a macro that can check if the Clipboard contains a range from 
Excel and then make an "exact copy" of all the range formulas into a new 
worksheet / workbook without formula address changes.
Thank you for any suggestion ????

6. Pasting from Excel Clipboard with VBA Macro

7. Using insert to paste a row--how done in Excel 2007

8. VBA Clipboard Cut & Paste from Excel to Outlook



Return to MS EXCEL

 

Who is online

Users browsing this forum: No registered users and 97 guest