PDA

View Full Version : Solved: Save as Web Archive



markh1182
06-08-2007, 06:37 AM
Hi, I have the following 2 pieces of code. One saves a document to html and works no problem, however the other does not save the document as a Web Archive (mht) correctly.

Any ideas?


Sub text2()ActiveDocument.SaveAs "c:\test.htm", FileFormat:=wdFormatHTML

End Sub

Sub text()ActiveDocument.SaveAs "c:\test.mht", FileFormat:=wdFormatWebArchive

End Sub

fumei
06-10-2007, 09:48 PM
No offense, but...
the other does not save the document as a Web Archive (mht) correctly.Wait a second while I rub my forehead and read your mind and know exactly what not correctly means.

It means your code crashes with some error that you are not mentioning, and nothing is saved....

No, wait, it means that nothing happens at all;

No wait, it means the code actually works fine, but the archive file can not be opened....

no, wait it means....

Sarcasm aside.....

1. you also do not mention what version of Word..

2. you can not save as web archive unless Outlook Express is installed. You may not use Outlook Express (that does not matter) but it MUST be installed. Web Archive uses the file Inetcomm.dll - which is installed by Outlook Express.

You MAY want to try and get Inetcomm.dll and install (register) it by itself. I have no idea if that will work. Never tried it. If you do get Inetcomm.dll and register it solo, and it works, by all means make sure you tell us. That would be a possibly useful piece of information.

If this does not help, please restate clearly what is not correctly working.

markh1182
06-11-2007, 04:23 AM
Hi, I am using Word 2000. I have installed the web archive functionality from Microsoft so that if you right click a saved web page in explorer, you can save as a web archive that way, but want to be able to do it using vba.

From it doesnt save correctly I mean, the code runs, saves the document and when you look at it in explorer it is saved as a web archive .mht file type, but when you try to open, it does not open as a web page as you would expect. It opens with:

ActiveDocument.SaveAs "c:\test.mht", FileFormat:=wdFormatWebArchiveEnd SubSub text2()ActiveDocument.SaveAs "c:\test.htm", FileFormat:=wdFormatHTMLEnd Sub DOCPROPERTY DocLoc H:\94\USERS\MIL\_HINCMA\DEV\EXARI\SAVEASWEB.DOC…??????????? jU B*ph   PQYef??­??????

etc in it.

The inetcomm.dll is registered and is in the winnt/system32 folder.

Hope this is more useful for you.

fumei
06-12-2007, 01:10 PM
OK, thank you. Niow we know what is happening.

Although....at the moment, I am stumped. This is what shows up as text in the opened file?


ActiveDocument.SaveAs "c:\test.mht", FileFormat:=wdFormatWebArchive
End Sub
Sub text2()ActiveDocument.SaveAs "c:\test.htm",

I have put bold where it looks mighty suspicious to me.

What is the connection with Explorer?
if you right click a saved web page in explorer, you can save as a web archive that way, but want to be able to do it using vbaDoing this in explorer is different from saving a document IN WORD as a web archive.

And i do niot have that functionality in Explorer. But I can save web pages in Word as web archive, and reopen them as web pages.

Hmmmmm.

markh1182
06-14-2007, 02:32 AM
Which version of Word are you running?

fumei
06-15-2007, 01:03 PM
2002

markh1182
06-20-2007, 07:30 AM
If I use that same code and run it in Word 2003 it works fine. Since we will hopefully be moving to that soon I will leave this.

Thanks for your help, Mark.