VBA to copy - paste data from Client to CSV file

el_jm

New Member
Joined
Oct 21, 2014
Messages
21
Hello I need to finalize this script to copy paste data to my "H:\x\x.csv" file, ideally on column B of csv file.
My script works fine till command move cursor 3, 14, (see red line in code) which is actually the data I need to copy paste to column B of my CSV file

Any help?
Thanks,


Sub htsm_PODHIS()
Dim Title, Default, fileloc, strLine, arrValues, fso, inputFileStream
Dim line As String
With Session
fileloc = "H:\x\x.csv" ' Set default
Const conStrSeparator = ";"
Set fso = CreateObject("Scripting.FileSystemObject")
Set inputFileStream = fso_OpenTextFile("H:\x\x.csv", 1, False, 0)
Do Until inputFileStream.AtEndOfStream
strLine = inputFileStream.ReadLine
arrValues = Split(strLine, conStrSeparator)
.WaitForEvent rcKbdEnabled, "0", "1", 3, 30
.MoveCursor 3, 30 'campo D
.TransmitTerminalKey rcIBMEraseEOFKey
.TransmitANSI arrValues(0)
.TransmitTerminalKey rcIBMEnterKey
.TransmitTerminalKey rcIBMEnterKey

.MoveCursor 3, 14 ' Need to copy-paste this field to H:\x\x.csv !!!!
.SelectWord rcMouseRow, rcMouseCol
.inputFileStream.Paste
Loop

inputFileStream.Close

End With

End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
... In fact, I want to know if it is possible to get content from remote application (when cusror is on field 3, 14 of client) and to copy/ paste this element in the file I have in "H:\x\x.csv" (B col.)
The possibility to generate a .txt file in "H:\x\" listing references I am getting (from field 3, 14) using my loop is also fine.
I really do not know how to work my script to do such & globally understand it is not possible to "write" on a file I am using to "read" in remote app. ...
 
Upvote 0

Forum statistics

Threads
1,216,068
Messages
6,128,595
Members
449,460
Latest member
jgharbawi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top