How to stop word displaying on the screen

S

Steve Bugden

Hi,

I have written some code to open create a word object and save a word
document as html.

THis works fine, except that the document flashes up on the screen briefly.
I have set the visible propery to false, is there something else I need to do?

The code below is late bound, but I get the same effect with early binding.

Any suggestions very gratefully received.

Steve.

Dim strWordFileName as string = "myfilename.doc"
Dim strHTMLFileName as string ="myfilename.htm"

Dim MSWord As Object
MSWord = CreateObject("Word.Application")
MSWord.Visible = False
MSWord.Documents.Open(FileName:=strWordFileName, ReadOnly:=True)
MSWord.ActiveDocument.SaveAs(FileName:=strHTMLFileName, FileFormat:=10)
MSWord.Documents.Close()
MSWord.Quit()
MSWord = Nothing
 
A

Anand.V.V.N

Hi Steve,

I used the following line and I was successfuly in not displaying the
application. This might work

word.Application.Visible=False

Anand
 
S

Steve Bugden

Hi,

Many thanks for the reply. I tried the suggestion but unfortunately I still
get Word flashing up on the screen.

I am using Word 2002 by the way.

Regards,

Steve Bugden.
 
A

Anand.V.V.N

Hi Steve,

By the way are you using it in VBA? or calling your code from a user form?
 
S

Steve Bugden

Hi Anand,

No, I am running from visual studio.net 2003. Sorry I should have said before.

Thanks for following my question up.

Steve
 

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