HTMLProject and Office 2007

A

ai38kpo

Since I installed Office 2007 beta (latest one on May 26th), I am unable to
access the HTMLProject property of a Word Document object using VB6. I get
"Application Defined Error" if I view it using Watch. I get method of ~
failed when running the program. Basically the code is:

Set WordApp = CreateObject("Word.Application")
Set worddoc = WordApp.Documents.Add
Set prjItem = worddoc.HTMLProject.HTMLProjectItems.Item(1)

This code works fine in Word 2000, XP and 2003.

Any ideas what may be wrong?

Thanks
Kevin O'Brien
 
K

Klaus Linke

Hi Kevin,

AFAIK MS scrapped the script editor and everything that has to do with it
completely.
Sorry for the bad news... but you probably will have to switch to the new
XML stuff.
Or save as HTML and get the HTML source from there.

Greetings,
Klaus
 
A

ai38kpo

Klaus,
I am not using the script editor. I am accessing the object model through
VB6. The property exists but does not appear to be accessible. What I am
trying to do is to insert HTML into a document programatically.

Thanks
Kevin
 
K

Klaus Linke

It was in the Object Model because of the script editor.
I have currently similiar problems... Say, context menus no longer allow
edit controls, dropdown controls or combo boxes, just buttons and popups.
So my old code from 2003 doesn't work any more.

Similar for the old file search, versions, AutoSummarize, ... which don't
exist any more (AFAIK).

worddoc.HTMLProject.HTMLProjectItems.Item(1) did little more than convert
the doc to HTML, write that to a temporary file, and give you the text.
You will have to do that yourself now.

Regards,
Klaus
 
A

ai38kpo

Klaus,
Thank you. This means that quite a few applications are going to be
broken in this release. What I am doing is inserting HTML into a Word
document. Do you have any suggestions as to how I can now do this?

Kevin
 
K

Klaus Linke

Are these valid HTML files you want to insert? Or fragments?
I guess you have the HTML in some string?

There seem to be two possibilities:
-- Save the HTML in a HTML file (if it isn't there already) and insert the
file (.InsertFile).
-- Try to get the HTML onto the clipboard and paste.

The latter is more difficult, but likely to be faster.
You could google the vba newsgroups for something -- I think something like
this came up a few times.
<http://groups.google.com/groups?q=vba+string+clipboard+HTML+group:microsoft.public.*>
(Maybe you can figure out a better search)

Regards,
Klaus
 

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