Opening A word Doc using VbA Word doc opens but minimizes

D

Danny

I have the following code I use in an Excel 2003 form to open a word
doc 2003. It opens fine but minimizes automatically after it opens.

Any ideas????

Private Sub()
Dim appWord As New Word.Application
Dim myDocument As Word.Document

Set appWord = CreateObject("word.application")
appWord.Application.Visible = True
Set myDoc = appWord.Application.Documents.Open("C:wordfile.doc")

Set myDocument = Nothing
Set appWord = Nothing

End sub

Thanks
D
 
A

Avi

I thnk you should use
appWord.Application.Visible = True
after Set myDoc = appWord.Application.Documents.Open
("C:wordfile.doc") statement.
 
B

Barb Reinhardt

I think I'd change
Set myDoc = appWord.Application.Documents.Open("C:wordfile.doc")

to

Set myDoc = appWord.Documents.Open("C:wordfile.doc")
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.
 
D

Danny

I thnk you should use
appWord.Application.Visible = True
after  Set myDoc = appWord.Application.Documents.Open
("C:wordfile.doc") statement.









- Show quoted text -

Thanks for your repsponse. So are you saying that the set mydocument
and set appword shouldn't be in the code? I thought that the set
cleared out the memory? Am I wrong on this?

Thanks
D
 
D

Danny

I think I'd change
Set myDoc = appWord.Application.Documents.Open("C:wordfile.doc")

to

Set myDoc = appWord.Documents.Open("C:wordfile.doc")
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.






- Show quoted text -

Again I appreciate the response here is what I changed per your help
Dim appWord As New Word.Application
Dim myDocument As Word.Document

Set appWord = CreateObject("word.application")
appWord.Application.Visible = True
Set myDoc = appWord.Documents.Open("T:\User_Budget_Test
\Forecasting instructions.doc")


Set myDocument = Nothing
Set appWord = Nothing

However it still minimizes after launching the code.

I also tried the removal of the set mydocument and set appword and
that didn't work either.

it is stange how it opens the document but minimizes right after
opening :)

If any other ideas come to mind I would love to hear them

D
 
D

Danny

I think I'd change
Set myDoc = appWord.Application.Documents.Open("C:wordfile.doc")

to

Set myDoc = appWord.Documents.Open("C:wordfile.doc")
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.






- Show quoted text -

Again I appreciate the response here is what I changed per your help
Dim appWord As New Word.Application
Dim myDocument As Word.Document

Set appWord = CreateObject("word.application")
appWord.Application.Visible = True
Set myDoc = appWord.Documents.Open("C:\worddoc.doc")


Set myDocument = Nothing
Set appWord = Nothing


However it still minimizes after launching the code.


I also tried the removal of the set mydocument and set appword and
that didn't work either.


it is stange how it opens the document but minimizes right after
opening :)


If any other ideas come to mind I would love to hear them


D
 

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