|
-
Nov 12th, 2004, 01:56 PM
#1
Thread Starter
Addicted Member
Excel VBA: How to get text fro0m clipboard?
Hi all,
In my Excell app I need to get text from clipboard, parse it and fill table...
VBA does not support Clipboard object like in VB...
I tried to use API functions, but every time it fails on CopyMemory function
Any ideas??? Short example will be very useful!
Thanks,
-
Nov 15th, 2004, 05:37 AM
#2
Addicted Member
I wonder if your method is the best one. The simplest way of getting data from the clipboard is to Paste it into a worksheet and process there. You can always delete the sheet afterwards.
If you have a text file containing data, delimited or not, use Application.WorkBooks.OpenText which will open the file and do all the work for you (best to record a macro using Excel menu File/Open).
Visual Basic for Applications does, however, have a DataObject with methods Clear, GetFormat, GetFromClipBoard, GetText, PutInClipBoard, SetText, StartDrag.
Code:
'- partial code
Dim MyDataObject As DataObject
Set MyDataObject = New DataObject
MyDataObject.GetFromClipBoard
Regards
BrianB
-------------------------------
-
May 26th, 2005, 03:34 AM
#3
Re: Excel VBA: How to get text fro0m clipboard?
Brian,
I looked at this code, but doesn't seem to work without a form. I am trying to prevent pasting multiple columns in my excel sheet and am totally lost at the moment.
Could you give it a shot?
Regards,
Abhijit
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
May 26th, 2005, 03:03 PM
#4
Fanatic Member
Re: Excel VBA: How to get text fro0m clipboard?
According to "VBA Developer's Handbook", you can use clipboard API's with VBA.
VBAhack
-
May 26th, 2005, 10:50 PM
#5
Re: Excel VBA: How to get text fro0m clipboard?
I do not have a copy of the developer's handbook.
I feel that this is something that should be solvable by using excel object.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
May 27th, 2005, 03:34 PM
#6
Fanatic Member
Re: Excel VBA: How to get text fro0m clipboard?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|