|
-
Nov 10th, 2005, 08:07 PM
#1
Thread Starter
Frenzied Member
[Resolved] Capture required data from ClipBoard
Hi,
I need to select particular data from clip board and paste it into my word document. How can i do that?
Let's say I have the following data/Text in ClipBoard:
Student ID: 123
Student Name: ABC
Class: 12th
Year: 2005-06
I need to capture the student Name "ABC" alone.
How can I achieve that?
Thanks in advance.
CS.
Last edited by cssriraman; Nov 12th, 2005 at 12:08 AM.
Reason: Change the status to Resolved
-
Nov 10th, 2005, 09:01 PM
#2
Re: Capture required data from ClipBoard
I successfully tested this (based on the example):
VB Code:
Dim MyData As DataObject
Dim strArr() As String
Dim intCount As Integer
Dim intIdx As Integer
Set MyData = New DataObject
'Obtain the data from the ClipBoard
MyData.GetFromClipboard
'Split the data into an Array
strArr() = Split(MyData.GetText(1), vbCrLf)
intCount = UBound(strArr)
For intIdx = 0 To intCount
If InStr(strArr(intIdx), "Student Name:") Then
MsgBox Trim$(Split(strArr(intIdx), "Student Name:")(1))
End If
Next
You may need adional validation of data, but this is a place to start
-
Nov 11th, 2005, 10:01 PM
#3
Thread Starter
Frenzied Member
Re: Capture required data from ClipBoard
Thanx Bruce!
I think this will work fine in Visual basic. But I want to use this function in VBA for Word / Excel.
I tried but it is not working. Pls Help!!!!!!!!!!!!!!!!
CS.
-
Nov 11th, 2005, 11:26 PM
#4
Re: Capture required data from ClipBoard
As per the PM
-
Nov 12th, 2005, 12:06 AM
#5
Thread Starter
Frenzied Member
Re: Capture required data from ClipBoard
Hi,
Thanx! for you reply.
Previously it was not working for me. At last i found the key.
I haven't set the reference to Microsoft Forms 2.0 object library in my VBA project.
That's the problem.
Now the same code which you gave works fine for me.
Thanks a lot!
CS.
-
Nov 12th, 2005, 12:24 AM
#6
Re: [Resolved] Capture required data from ClipBoard
No probs.
Good luck
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
|