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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field scrape from Terminal to Excel

Status
Not open for further replies.

2010noACAPS

Technical User
Mar 29, 2004
41
US
I am very new to VB and am trying to right a macro for Excel that will take scrapes from a Terminal program and put the information in a manifest. My manifest is set up to have a 2 row header, "A" is numbered 1-34, there are three columns, "B" is formatted to be 10 digits long so anything under 10 digits has leading zeros. Right now it kind of works, but the problem I'm having is since I told it
Code:
CustomNumber = gHostScreen.GetString(7, 33, 10)
Cells(Cells.SpecialCells(xlCellTypeLastCell).Row + 1, 3).Value = CustomNumber

CustomerName = gHostScreen.GetString(3, 2, 18)
LastName = Left$(CustomerName, InStr(1, CustomerName, ",", 1) - 1)
Cells(Cells.SpecialCells(xlCellTypeLastCell).Row + 1, 4).Value = LastName
It's printing at the bottom of the manifest and putting Customer name one row down from CustomerNumber instead of side-by-side. My CustomerNumber is also printing "_" for numbers that are not 10 digits long.

Can anyone help?
 
Something like this ?
NewRow = Cells.SpecialCells(xlCellTypeLastCell).Row + 1
CustomNumber = Replace(gHostScreen.GetString(7, 33, 10), "_", "0")
Cells(NewRow, 3).Value = CustomNumber
CustomerName = gHostScreen.GetString(3, 2, 18)
LastName = Left$(CustomerName, InStr(1, CustomerName, ",", 1) - 1)
Cells(NewRow, 4).Value = LastName

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Well, that got them printing side by side. Now I find that it's printing the number I inputed that pulls up the Terminal record beside the previous records number and name. I also don't think I want Replace, but rater a Trim function to get off the trailing spaces for the CustomerNumber. It's also still printing at the bottom of my chart instead of at line 1 (B4).
 
Something like this ?
CustomNumber = Format(Replace(gHostScreen.GetString(7, 33, 10), "_", ""), "0000000000")
I don't quite understand your row issue.
I just showed you why the Customer name was putted one row down from CustomerNumber


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yes, and your snippet worked great. My fields are now printing side by side. But my other issue was that my macro is inputting the screen scrapes at B38:D38. But it's also inputting the current record number in B39 and the CustomerNumber and CustomerName for B38's record number. I don't understand why it's printing the previous record number's info next to the current record number.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top