#1
|
||||
|
||||
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'm getting ByRef Argument Type Mismatch" Error where am I making mistake(s). |
#2
|
||||
|
||||
It will help you if you add Option Explicit to the top of your modules (you can do this automatically from the VBA Editor > Tools > Options > Require Variable Declaration). Then from the Debug Menu > Compile Normal
This will show the obvious variable errors. Fix those and you may be getting somewhere.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
||||
|
||||
Bingo. Just few simple mistakes.
|
Tags |
vba, wordvba |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Restrict Editing function disable insert textbox function | IanM_01 | Word | 5 | 11-21-2015 02:29 AM |
Word 2007 Review Function Problem | sbudaj | Word | 0 | 10-09-2015 12:30 PM |
Function problem | li roy | Excel | 2 | 02-18-2012 02:44 AM |
Checkmark function problem | todddesignr | PowerPoint | 0 | 07-29-2011 07:40 AM |
Search Function Problem | MageWind | Excel | 2 | 06-29-2011 09:46 AM |