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!

Attachmate Macro to read data from Excel 2

Status
Not open for further replies.

Mikemix

Programmer
Feb 25, 2003
5
US
Hi,
I’m looking for an elegant way to read data from cell's from within an Excel sheet using Attachmate Extra Basic.
Im using Extra 5.2.
I need to get data from cells within excel and store them in variables to apply functions on the data and insert the processed data in fields in a session.

Anyone who can provide me with some example code would be much appreciated.

Thank you,
Mikemix
 
I was able to solve my problem... i created and ran the extra macro in Excel (with a few mods of course)... this way I have access to all of the Excel objects & methods unfettered...


 
Create a input file from excel.
1) Setup pipes: |Text1|Text2|Text3|
2) Start your beginning information with this script.

Open sInputFile For Input As #1
sOutputFile = mid(sinputfile,1,len(sinputfile)-4) & "Output.doc"
msgBox ("'" & sOutputFile & "' Will be your output file")

Open sOutputFile for Output As #2

Do While Not EOF(1)
line input #1, sLineText
iStartPipe = 0
iEndPipe = InStr(iStartPipe + 1, sLineText, "|")

iLoopCount = 0
Do Until iendPipe = 0

sInput(iLoopCount) = mid(sLineText, iStartPipe + 1, iEndPipe - iStartPipe - 1)
iLoopCount = iLoopCount + 1
iStartPipe = iEndPipe
iEndPipe = InStr(iStartPipe + 1, sLineText, "|")


Loop

sText1 = sInput(0)
sText2 = sInput(1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top