Ok I am using a function that I found on this forum (its freakin great, I LOVE IT!) I have never had a problem with it up until now, basically the prodcedure its erroring on is when the program signs into employee's timeclock account, when it signs in, it needs to grab some dynamic text, as well as grab last 4 of social (which is done on the website the program goes to)
Here is the strFindBetween Function
And here is the code for when the program logs in...Code:Public Function strFindBetween(strToSearch As String, strStartPoint As String, strEndPoint As String, Optional skipInstance As Integer = 0) As String 'Quit the function if infomation provided doesn't fit requirements 'Finds a string, between 2 strings good for grabbing aritlce text! If strToSearch = "" Or strStartPoint = "" Or strEndPoint = "" Then Exit Function If Not InStrB(strToSearch, strStartPoint) > 0 And InStrB(strToSearch, strEndPoint) > 0 Then Exit Function Dim trimStrLine As String Dim strResult As String Dim skipInst As Integer trimStrLine = strToSearch 'Skip instances of first string; default doesn't skip For skipInst = 0 To skipInstance trimStrLine = Mid$(trimStrLine, InStr(trimStrLine, strStartPoint) + Len(strStartPoint)) Next skipInst 'Trim the line to the end of the second specified string trimStrLine = Mid$(trimStrLine, 1, InStr(trimStrLine, strEndPoint) - 1) 'Assign the string between the two given string-points strFindBetween = trimStrLine End Function
Now the error I keep getting is Run-Time Error '5', Invalid procedure call or arguement. And highlights this code in the bas mod, under strFindBetween's functionCode:ElseIf InStr(S$, "title='Punch In & Time Clock'>Add Minutes & Hours</a>") <> 0 Then Stat "landed on main signin page, yeayay!" txtData.text = wOd1.Response.Body CompanyID$ = strFindBetween(txtData.text, "{ companyId: ", " },") Stat "grabbed company id [" & CompanyID$ & "]" wOd1.Get "http://www.rothco.com/UpdateDetails.aspx?Employee_PunchIn_NationalCO=ContactDetails&CompanyID=" & CompanyID$ Stat "going to contact page for meh info!" ElseIf InStr(S$, "Contact Details for your listing") <> 0 Then Stat "landed on contact info page, scrapin it'" txtData.text = wOd1.Request.Body 'BotAddy$ = strFindBetween(txtData.text, "GoogleMap.AddressLocator.Address = '", "';") 'BotName$ = strFindBetween(txtData.text, "ctl00$contentSection$ctrlContactDetails$txtBusinessName" & txtQ.text & " type=" & txtQ.text & "text" & txtQ.text & " value=" & txtQ.text, txtQ.text & " maxlength=" & txtQ.text & "150" & txtQ.text & " id=") 'BotCity$ = strFindBetween(txtData.text, "ctl00$contentSection$ctrlContactDetails$txtSuburb" & txtQ.text & " type=" & txtQ.text & "text" & txtQ.text & "value=" & txtQ.text) 'BotpNumber$ = strFindBetween(txtData.text, "ls$txtPhone" & txtQ.text & " type=" & txtQ.text & "text" & txtQ.text & " value=" & txtQ.text, txtQ.text & " maxlength=" & txtQ.text & "50" & txtQ.text & " id=" & txtQ.text & "ctl00_contentSection_ctrlContactDetails_txtPhone" & txtQ.text) 'BotWebSite$ = strFindBetween(txtData.text, "ctl00$contentSection$ctrlContactDetails$txtWebsite" & txtQ.text & " type=" & txtQ.text & "text" & txtQ.text & " value=" & txtQ.text, txtQ.text & " maxlength=" & txtQ.text & "200" & txtQ.text & " id=" & txtQ.text & "ctl00_contentSection_ctrlContactDetails_txtWebsite") Pause 1 BotEMail$ = strFindBetween(S$, "ctl00$contentSection$ctrlContactDetails$txtEmail" & txtQ.text & " type=" & txtQ.text & "text" & txtQ.text & " value=" & txtQ.text, txtQ.text & "maxlength=" & txtQ.text & " 100" & txtQ.text & " id=" & txtQ.text & "ctl00_contentSection_ctrlContactDetails_txtEmail") MsgBox BotAddy$ & vbNewLine & BotName$ & vbNewLine & BotCity$ & vbNewLine & BotpNumber$ & vbNewLine & BotWebSite$ & vbNewLine & BotEMail$ End If
Thats the line it highlights...any idea's I use this function for allot, whenever I need to grab text / strings off a webpage I have the page's source loaded in a textbox & then call this function or have the page's source be S$ and call the function w/ that. HELP! <3Code:trimStrLine = Mid$(trimStrLine, 1, InStr(trimStrLine, strEndPoint) - 1)




Reply With Quote