Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy/Paste from OLE to Access 2003 2

Status
Not open for further replies.

krieg313

Technical User
May 5, 2011
22
US
I am having trouble pasting data from my OLE object below.
The code logs in to an application, goes into a certain screen
and then from a certain position to another it copies text, which is not in any format whatsoever.
here is an example:

SPECIAL BROKER PULL 0 0 0
UNIDENTIFIED PIECES 2 15 14
CANADA 16 66 51
FOREIGNS 67 979 913
FIRST CLASS SINGLES 0 0 0
FIRST CLASS MULTIS 0 0 0
FRFC 980 1,383 404
FIVE DIGIT MULTIES 0 0 0
NINE DIGIT MULTIES 0 0 0
FIVE DIGIT PRESORT 0 0 0
NINE DIGIT PRESORT 1,384 37,962 36,579

these values are not in cells/tables. I would like to automate pasting this info into a textbox so that i can later
grab: ex. Nine Digit Presort - 36579.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Option Compare Database

Public Sub Command4_Click()
Dim DataFromProxyPlus As String
Dim hostpassword As String
Dim Session As Object
Dim Selection As Object
Dim CopyData
Const SessionCon = "149.83.123.3"

Set Session = CreateObject("ReflectionIBM.Application")
With Session
.Visible = True
.SetupSession rc3270Terminal, rc3270MODEL2E, rcTelnet
.Hostname = "149.83.123.3"
.Connect

If .KeyboardLocked = 0 Then

.Connect
.WaitForEvent rcEnterPos, "30", "0", 5, 5
.TransmitANSI "prxy"
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "1", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 1, 1
.TransmitTerminalKey rcIBMClearKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 1, 1
.Wait (1)
.TransmitANSI "cesn"
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 10, 26
.WaitForDisplayString ".", "30", 10, 24
.TransmitANSI "tbyolmo"
.TransmitTerminalKey rcIBMTabKey
.TransmitTerminalKey rcIBMTabKey
.Wait (1)
hostpassword = "eq013342"
.TransmitANSI hostpassword
.TransmitTerminalKey rcIBMEnterKey

Else
.StopMacro
Exit Sub
End If

.WaitForEvent rcEnterPos, "30", "0", 24, 76
.WaitForDisplayString "NO.-->", "30", 24, 69
.TransmitANSI "66"
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 8, 54
.WaitForDisplayString "2-CANADIAN..>", "30", 8, 39
.TransmitTerminalKey rcIBMTabKey
.TransmitTerminalKey rcIBMTabKey

.WaitForEvent rcEnterPos, "30", "0", 13, 33
.WaitForDisplayString "NUMBER....>", "30", 13, 20
.TransmitANSI "n44689010"
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 8, 2
.TransmitTerminalKey rcIBMPf4Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 3, 22
.WaitForDisplayString "JOB................", "30", 3, 2
.TransmitTerminalKey rcIBMPf6Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 3, 10
.WaitForDisplayString "NO.", "30", 3, 6
.TransmitTerminalKey rcIBMPf5Key

.SetSelectionStartPos 7, 5
' .WaitForEvent rcEnterPos, "30", "0", 7, 5
' .WaitForDisplayString "2", "30", 7, 3
.ExtendSelectionRect 17, 67
.CopySelection
CopyData = .Paste

End With

TextBox = CopyData ' needs fix

Set Session = Nothing


End Sub
 
Thanks for the response.
Yes it copies text into the clipboard, because after the code stops, if i do Ctrl + V anywhere i get the text mentioned above.
 

If you have already data in your Clipboard and you want to paste it into your text box (I hope you have the textbox's MultiLine property set to True) you can just:
Code:
Text1.Text = Clipboard.GetText

Have fun.

---- Andy
 
Text2.Text = Clipboard.GetText

gives off error :

Object Variable or with blocl variable not set.
 

You do not have to declare Clipboard (as anything). It is already there, either you use it or not.

And I think in Access you just would do
[tt]
Text1 = Clipboard.GetText
[/tt]
for an unbound text box

Have fun.

---- Andy
 

And just to see how it works you may try:
Code:
MsgBox Clipboard.GetText
[green]'or[/green]
Debug.Print Clipboard.GetText

Text2 = Clipboard.GetText

Have fun.

---- Andy
 
MsgBox Clipboard.GetText
'or
Debug.Print Clipboard.GetText

Text2 = Clipboard.GetText


when i run the code,
It gives off error
Run-time error "424"
Object Required.

 
andy:

note that in access clipboard is not an object

try
Code:
text2.setfoucs
docmd.RunCommand acCmdPaste
 

Thanks PWise,

Since we are in VB 5 & 6 Forum, and not in VBA, mine was a VB 6.0 answer.

Have fun.

---- Andy
 
Andy:
Sorry

krieg:
if you are using msaccess please pose in one of the acess fourms
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top