VBA reflection - CSV FILE

el_jm

New Member
Joined
Oct 21, 2014
Messages
21
Hello I am trying to insert data stored in a csv file in IBM3270 reflection.

My csv as only 2 column, this is no a complex loop, but I have a problem
in the first part of the code, i guess in fso open text file ...
Any help?
________

Sub i_cOMPO()

' i_cOMPO macro
' Macro created 26/11/2014


Dim Title, Default, fileloc, strLine, arrValues, fso, inputFileStream
Dim line As String
With Session

fileloc = "H:\DATA\COMPO.csv" ' Set default

Const conStrSeparator = ";"

Set fso = CreateObject("Scripting.FileSystemObject")

Set inputFileStream = fso_OpenTextFile("H:\DATA\COMPO.csv", 1, False, 0)
Do Until inputFileStream.AtEndOfStream
strLine = inputFileStream.ReadLine
arrValues = Split(strLine, conStrSeparator)

.MoveCursor 3, 58 'cons invcompo

.TransmitTerminalKey rcIBMEraseEOFKey

.TransmitANSI arrValues(0)
.TransmitTerminalKey rcIBMPf1Key
.WaitForEvent rcKbdEnabled, "0", "1", 58, 8

.MoveCursor 8, 2 'donde tiene que entrar la X
.TransmitTerminalKey rcIBMEraseEOFKey
.TransmitTerminalKey rcIBMXKey
'.Wait 1
.MoveCursor 6, 76 'Campo de la marca
.TransmitTerminalKey rcIBMEraseEOFKey
.TransmitANSI arrValues(1)

.TransmitTerminalKey rcIBMPf3Key

'.Wait 1

Loop

inputFileStream.Close

End With

End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi

I don't know IBM3270. I don't either know what "session" is, where it has been declared and where the object has been set. However I suspect that this line:
Code:
Set inputFileStream = fso.OpenTextFile("H:\DATA\COMPO.csv", 1, False, 0)
Is not the issue. It looks fine to me.

What error do you get and what line does it break on?
 
Upvote 0
Your file code works fine

So its the file called "H:\DATA\COMPO.csv" ?

and is it delimited by ";" ?

(maybe its still open from a previous crash)?
 
Upvote 0
Your file code works fine

So its the file called "H:\DATA\COMPO.csv" ?

and is it delimited by ";" ?

(maybe its still open from a previous crash)?

Charles, yes my file is a .CSV, stored in H: unit and ... no, there are actually not such (;) separator.
No crash. I will run this code again tomorrow...
 
Upvote 0
I forgot to mention that my CSV file does not contain decimal values and is excusively composed by hexadecimal values.
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,265
Members
449,219
Latest member
daynle

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