please help: Object variable or With block variable not set
please help: Object variable or With block variable not set
(OP)
Getting this error mesage but not sure y. Can someone please help. Im trying to scrape multiple row payments from Attachmate and input it into column E but i keep getting this error message
CODE -->
Global variable declarations Global g_HostSettleTime% Global g_szPassword$ Sub Main() '-------------------------------------------------------------------------------- ' Get the main system object Dim Sessions As Object Dim System As Object Set System = CreateObject("EXTRA.System") ' Gets the system object If (System Is Nothing) Then MsgBox "Could not create the EXTRA System object. Stopping macro playback." Stop End If Set Sessions = System.Sessions If (Sessions Is Nothing) Then MsgBox "Could not create the Sessions collection object. Stopping macro playback." Stop End If '-------------------------------------------------------------------------------- ' Set the default wait timeout value g_HostSettleTime = 3000 ' milliseconds OldSystemTimeout& = System.TimeoutValue If (g_HostSettleTime > OldSystemTimeout) Then System.TimeoutValue = g_HostSettleTime End If ' Get the necessary Session Object Dim Sess0 As Object Set Sess0 = System.ActiveSession If (Sess0 Is Nothing) Then MsgBox "Could not create the Session object. Stopping macro playback." Stop End If If Not Sess0.Visible Then Sess0.Visible = True Sess0.Screen.WaitHostQuiet (0) Dim fso As Object Dim ts As Object Dim i Dim strCBName Dim blnHasMoreLines Set obj = GetObject("C:\Documents and Settings\Harjinder_Chahal\Desktop\Projects\Book1.xlsm") 'File is already open 'create the file system object 'Set fso = CreateObject("Scripting.FileSystemObject") 'get the copybook name strCBName = "T328" 'create the copybook file 'Set ts = fso.CreateTextFile("C:\temp\" & strCBName & ".txt", True) blnHasMoreLines = True ' record the loan information & column headers once obj.Worksheets("Input").Cells(2, "A").Value = Sess0.Screen.GetString(4, 11, 1) obj.Worksheets("Input").Cells(2, "B").Value = Sess0.Screen.GetString(4, 18, 6) obj.Worksheets("Input").Cells(2, "C").Value = Sess0.Screen.GetString(4, 34, 11) obj.Worksheets("Input").Cells(2, "D").Value = Sess0.Screen.GetString(5, 2, 27) 'copy all lines on the screen except the header until there are no more lines While blnHasMoreLines blnHasMoreLines = (Sess0.Screen.Search("NEXT PAYMENT DUE DATE").Value = "") For i = 10 To 21 [COLOR="#FF0000"]obj.Worksheets("Input").Range("E2").Value = ts.Sess0.Screen.GetString(i, 10, 8)[/COLOR] Next i 'send the next page command Sess0.Screen.SendKeys ("<Pf8>") Sess0.Screen.WaitHostQuiet (0) Wend 'close and destroy objects ts.Close Set ts = Nothing 'Set fso = Nothing MsgBox "Done recording " & strCBName Sess0.Screen.WaitHostQuiet (0) System.TimeoutValue = OldSystemTimeout End Sub
RE: please help: Object variable or With block variable not set
Global variable declarations
is not a statement. It is a comment.
RE: please help: Object variable or With block variable not set
Furthermore, this loop will write all the values to one cell.
CODE
do you want all the values in column E or all in row 2?
RE: please help: Object variable or With block variable not set
CODE
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
CODE
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
could it be because of this line?
Set ts = fso.CreateTextFile("C:\temp\" & strCBName & ".txt", True)
i really dont want to create anything. Im just working on the current worksheet where the code is. If i comment that line, i get error message Object doesnt support this property or method on below line
Dim j as integer
j = 0
For i = 10 To 21
obj.Worksheets("Input").Range("E2").Offset(j).Value = ts.Sess0.Screen.GetString(i, 10, 8)
j = j + 1
Next i
RE: please help: Object variable or With block variable not set
CODE -->
RE: please help: Object variable or With block variable not set
Move the A variable initialization above the While...Wend
CODE
RE: please help: Object variable or With block variable not set
CODE -->
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
here is an example. The values in red i dont really need.
03/11/15 XC 180.00- 71.20- 108.80- 15,069.78 <----From 2nd last page
03/11/15 XC 180.00- 71.20- 108.80- 15,069.78 <----Last page duplicate
2,434.77- 15,069.78
INTEREST OR PYMT BY STUDENT .52 F: 52.49 P: 27.03
OF CHARGE 0
AYOUT .30 PAYABL LE ON 04/16 /15
INT., ON MTH IN T., MONTHS 0.21 68.47 1
MENT DUE ATE /15
using this code
CODE -->
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
CODE
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
CODE -->
I only want the row upto Totals including Interest and Principal. This is the last page. Totals is on line 12/2 in attachmate
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
am i missing code? cuz it still captures the other data below Totals which i dont want
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
CODE
RE: please help: Object variable or With block variable not set
Rather than SEARCH, he need to test the value in the For...Next loop FIRST and Exit fro that point.
RE: please help: Object variable or With block variable not set
CODE -->
VALUE DATE TYPE AMOUNT INTEREST PRINCIPAL PRINCIPAL OUTSTANDING 03/31/15 PA 331.48- 0.68- 330.80- 36.96 03/31/15
RE: please help: Object variable or With block variable not set
CODE -->
RE: please help: Object variable or With block variable not set
The first statement after For, must evaluate the TOTALS in the PROCESS DATE column. If it is TRUE, then exit The For and Do loops.
RE: please help: Object variable or With block variable not set
CODE
but it that fails, I would grab the entire row and compare it to the previous row of data that was scraped.
RE: please help: Object variable or With block variable not set
So each row MUST be tested in the PROCESS DATE 'column.'
RE: please help: Object variable or With block variable not set
CODE -->
03/31/15 PA 331.48- 0.68- 330.80- 36.96 03/31/15 PA 331.48- 0.68- 330.80- 36.96
CODE -->
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
Lastrow = Sheets("Input").Cells(65536, 1).End(xlUp).Row
Sheets("Input").Range("A" & Lastrow - 7 & ":" & "A" & Lastrow).Resize(9).Clear
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
In column A5 i have this data
01/01/15
02/01/15
03/01/15
04/01/15 <--Last date posted
'Blank Cell'
First
Last
Who
where
Why
when
candy
house
Data in red, i want those ROWS cleared.
RE: please help: Object variable or With block variable not set
If you want to reset your sheet turn on your macro recorder an record deleting everything from row 5 to the bottom of the sheet.
Then observe your recorded code, modify as needed on your procedure.
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
THAT is why the screen navigation logic should be the FIRST matter of design and coding importance, as I previously urged you to consider. Kind of painful, is it not, to have arrived at this point by such a circuitous route?
CODE
RE: please help: Object variable or With block variable not set
First you look for the TOTALS string in the rows that could contain the dates, as it appears from your posts that that happens, to exit the For...Next loop
Then, once rows 10-21 are processed, you search for TOTALS to exit the Do..Loop.
CODE
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
So here's your screenshot of the last page
So I assume that on row 10 column 10 you have 03/31/15 and on row 12 column 10 you have TOTALS. correct?
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
CODE -->
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
RE: please help: Object variable or With block variable not set
Over a period of 40 years, at LTV, Northrup Grumman, Lockheed Martin and Bell/Textron, they ALL had at one time IBM Mainframe systems and used 3270 terminal emulators (Attachmate!Extra). They ALL used professionally programmed transaction based screens that painted 24 rows and F8 to get the next 24 rows, each screen had a MESSAGE AREA, that described the status of data on the screen.
So I have no idea what scrolling is all about on your screen. Your expert programmers ought to have included such information to the user community. Your system or your description of your system (I can't figure out which) is really funky! So I'm about tapped out.
RE: please help: Object variable or With block variable not set