![]() |
Web query
I have written following query to pass date on web query
With .document.Forms(0) .txtFromDt.Value = 05/02/2008 .txtToDt.Value = 05/02/2008 End With Error message is thrown by system as "Object Variable or with block variable not set" Can anyone help me out to resolve this problem. Thank you. |
Web query
Try quoting those values. Something may also be missing, but your code
fragment is too small to tell. Tim "Vijay Kotian" wrote in message ... I have written following query to pass date on web query With .document.Forms(0) .txtFromDt.Value = 05/02/2008 .txtToDt.Value = 05/02/2008 End With Error message is thrown by system as "Object Variable or with block variable not set" Can anyone help me out to resolve this problem. Thank you. |
Web query
The codes are attached herewith. You may not able to access to the site
specified Range("A2").Select ActiveCell.FormulaR1C1 = "=TODAY()- 1" Range("D2").Select Selection.Copy Range("E2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ate = ActiveCell.Value ActiveCell.FormulaR1C1 = "'" & ate ate = ActiveCell.Value Range("F2").Select Selection.Copy Range("G2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False onth = ActiveCell.Value ActiveCell.FormulaR1C1 = "'" & onth onth = ActiveCell.Value Range("H2").Select Selection.Copy Range("I2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ear = ActiveCell.Value ActiveCell.FormulaR1C1 = "'" & ear ear = ActiveCell.Value Dim ie As Object ' On Error GoTo 1 Set ie = CreateObject("InternetExplorer.Application") With ie .navigate "http://10.6.4.48/ET/index.html" .Visible = True Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop With .document.Forms(0) .txtUname.Value = "XXXXXXX" 'Change to YOUR Login ID .txtPass.Value = "YYYYYYYY" 'Change to YOUR password .btnsubmit.Click End With Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop ' Date = Format$(Now(), "MM/DD/YYYY") With ie .navigate "http://10.6.4.48/ET/ErrorTrade.jsp?PARAM1=5:&Header=OTHeader.jsp&RPTNA ME=Open%20Error%20Trades" Application.DisplayAlerts = False Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) Application.SendKeys ("{TAB 7}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop End With Application.SendKeys "~" Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.SendKeys ("{TAB 4}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.SendKeys "~" Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) ' Windows("Book1.xls").Activate ' ActiveWorkbook.SaveAs Filename:="O:\Client details\EOD Reports\Vandha\working\Opentrades.XLS", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False ' Application.SendKeys ("%FX") Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) With ie .navigate "http://10.6.14.148/ET/ErrorTrade.jsp?PARAM1=6:&Header=UNTHeader.jsp&RPTN AME=Unauthorized%20Trades" .Visible = True Application.DisplayAlerts = False Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) Application.SendKeys ("{TAB 4}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop End With Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) With .document.Forms(1) Application.SendKeys ("01/04/2007") ' Date requires to be changed every year Application.SendKeys ("{TAB 7}") End With Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) Application.SendKeys "~" Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) Application.SendKeys ("{TAB 4}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.SendKeys "~" Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 2) With ie .navigate "http://10.6.4.48/ET/ErrorTrade.jsp?PARAM1=3:D&Header=DNoErrHeader.jsp& RPTNAME=Dealerwise%20No.%20of%20Errors" .Visible = True Application.DisplayAlerts = False Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.SendKeys ("{TAB 4}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop End With With .document.Forms(0) .txtFromDt.Value = ate .txtToDt.Value = ate End With End With "Tim Williams" wrote: Try quoting those values. Something may also be missing, but your code fragment is too small to tell. Tim "Vijay Kotian" wrote in message ... I have written following query to pass date on web query With .document.Forms(0) .txtFromDt.Value = 05/02/2008 .txtToDt.Value = 05/02/2008 End With Error message is thrown by system as "Object Variable or with block variable not set" Can anyone help me out to resolve this problem. Thank you. |
Web query
Formatted like this I can't really figure out all those nested 'with'
blocks. Can you create a smaller fragment which shows the same problem? But start by quoting the values you're trying to assign to the textboxes. Tim "Vijay Kotian" wrote in message ... The codes are attached herewith. You may not able to access to the site specified Range("A2").Select ActiveCell.FormulaR1C1 = "=TODAY()- 1" Range("D2").Select Selection.Copy Range("E2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ate = ActiveCell.Value ActiveCell.FormulaR1C1 = "'" & ate ate = ActiveCell.Value Range("F2").Select Selection.Copy Range("G2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False onth = ActiveCell.Value ActiveCell.FormulaR1C1 = "'" & onth onth = ActiveCell.Value Range("H2").Select Selection.Copy Range("I2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ear = ActiveCell.Value ActiveCell.FormulaR1C1 = "'" & ear ear = ActiveCell.Value Dim ie As Object ' On Error GoTo 1 Set ie = CreateObject("InternetExplorer.Application") With ie .navigate "http://10.6.4.48/ET/index.html" .Visible = True Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop With .document.Forms(0) .txtUname.Value = "XXXXXXX" 'Change to YOUR Login ID .txtPass.Value = "YYYYYYYY" 'Change to YOUR password .btnsubmit.Click End With Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop ' Date = Format$(Now(), "MM/DD/YYYY") With ie .navigate "http://10.6.4.48/ET/ErrorTrade.jsp?PARAM1=5:&Header=OTHeader.jsp&RPTNA ME=Open%20Error%20Trades" Application.DisplayAlerts = False Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) Application.SendKeys ("{TAB 7}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop End With Application.SendKeys "~" Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.SendKeys ("{TAB 4}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.SendKeys "~" Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) ' Windows("Book1.xls").Activate ' ActiveWorkbook.SaveAs Filename:="O:\Client details\EOD Reports\Vandha\working\Opentrades.XLS", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False ' Application.SendKeys ("%FX") Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) With ie .navigate "http://10.6.14.148/ET/ErrorTrade.jsp?PARAM1=6:&Header=UNTHeader.jsp&RPTN AME=Unauthorized%20Trades" .Visible = True Application.DisplayAlerts = False Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) Application.SendKeys ("{TAB 4}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop End With Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) With .document.Forms(1) Application.SendKeys ("01/04/2007") ' Date requires to be changed every year Application.SendKeys ("{TAB 7}") End With Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) Application.SendKeys "~" Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1) Application.SendKeys ("{TAB 4}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.SendKeys "~" Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 2) With ie .navigate "http://10.6.4.48/ET/ErrorTrade.jsp?PARAM1=3:D&Header=DNoErrHeader.jsp& RPTNAME=Dealerwise%20No.%20of%20Errors" .Visible = True Application.DisplayAlerts = False Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop Application.SendKeys ("{TAB 4}") Do While .busy: DoEvents: Loop Do While .ReadyState < 4: DoEvents: Loop End With With .document.Forms(0) .txtFromDt.Value = ate .txtToDt.Value = ate End With End With "Tim Williams" wrote: Try quoting those values. Something may also be missing, but your code fragment is too small to tell. Tim "Vijay Kotian" wrote in message ... I have written following query to pass date on web query With .document.Forms(0) .txtFromDt.Value = 05/02/2008 .txtToDt.Value = 05/02/2008 End With Error message is thrown by system as "Object Variable or with block variable not set" Can anyone help me out to resolve this problem. Thank you. |
Web query
As already suggested - try quoting the values.
With .document.Forms(0) .txtFromDt.Value = "05/02/2008" .txtToDt.Value = "05/02/2008" End With Tim "Vijay Kotian" wrote in message ... Forget the codes mentioned eariler ..... I am getting stuck at the following codes i.e. With .document.Forms(0) .txtFromDt.Value = 05/02/2008 .txtToDt.Value = 05/02/2008 End With I would like to pass date but getting error as "Object Variable or with block variable not set" ? The codes of web is as under OR can you rewrite the code so that I can pass date value through VBA ; |
All times are GMT +1. The time now is 09:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com