Invalid procedure error using innerHTML

C

Charley Kyd

I just came across a FrontPage error and a solution that might help others.

While looping through every page on my site, I occasionally got an "Invalid
procedure call or argument" error for the last line in the code fragment
below.

======
Sub Foo(pwCur As FrontPage.PageWindow)
Dim objRange As IHTMLTxtRange, sText As String

Set objRange = pwCur.Document.body.createTextRange
sText = objRange.htmlText
pwCur.Document.body.innerHTML = sText
=======

I knew that the code syntax is correct, because it worked for 95% of the
pages.

It turns out that the pages that generated the error had syntax problems
with their HTML. Several pages had an extra </a> tag, and others had an
extra </td> tag.

So if you experience this error, check your html syntax.

Regards,

Charley Kyd
ExcelUser.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top