View Single Post
 
Old 01-12-2016, 10:23 PM
PRA007's Avatar
PRA007 PRA007 is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default Problem with function

I am trying to do following thing
Code:
Sub RPX1()
Application.ScreenUpdating = False
Dim Rng As Range, Tbl As Table, StrTxtE As String, valD As String, StrTxtD1 As String, StrTxtD2 As String, valD1 As String, StrTxt As String, StrTxtT As String, StrTxtD As String, HttpReq As Object, i As Long, j As Long, k As Long, l As Long, m As Long, n As Long, o As Long, doc As MSHTML.HTMLDocument, IE As SHDocVw.InternetExplorer
Dim wdApp As New Word.Application, wdDoc As Document
Set wdDoc = ActiveDocument
With wdDoc.Range
With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "http://search.rpxcorp.com*^13"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
End With
Do While .Find.Found
    URL = Split(.Text, Chr(13))(0)
        StrTxt = Get_RPX_Data(URL)
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
End Sub

Function Get_RPX_Data(URL As String) As String
'References to Internet Explorer & Microsoft HTML required
Dim Rng As Range, Tbl As Table, StrTxt As String, HttpReq As Object, i As Long, j As Long, StrTxtT As String, doc As MSHTML.HTMLDocument, IE As SHDocVw.InternetExplorer
Set HttpReq = CreateObject("Microsoft.XMLHTTP")
HttpReq.Open "GET", URL, False
HttpReq.send
StrTmp = HttpReq.responseText
Get_URL_Data = StrTmp
Application.ScreenUpdating = True
Set HttpReq = Nothing
End Function
I know that this is crap! Just learning to use functions.

I'm getting ByRef Argument Type Mismatch" Error

where am I making mistake(s).
Reply With Quote