Opening Word document

Hi !

How do i open a Word document ?
I use this :
Dim MyDoc As Word.Application

Set MyDoc = New Word.Application
MyDoc.Documents.Open ("c:\TP2\facture.doc")
It works great but i never actually see the Word document.
I'm adding data in it but it seems as if the transfer was done
in the background....
Is there any way that i could open the Word document once
the transfer is done ???

Also, when the file is already opened i have that read-only
warning message. How can i get rid of it ???

Thanks !
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dim MyDoc As Word.Application
    Set MyDoc = CreateObject("Word.Application")
    MyDoc.Documents.Open "c:\TP2\facture.doc"
    MyDoc.Visible = True

if u want to open the word file stored as a variable by clicking a button on the form.

set a reference to MS word object lib in your project and add this code :

Private Sub Command1_Click()

Dim MyApp As Object
Dim MyDoc As Object
Set MyApp = CreateObject("Word.Application")
Set myDoc = MyApp.Documents.Open("C:\TP2\facture.doc")
MyApp.Visible = True

End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rouxjeanAuthor Commented:
Thx :)
and how about the warning message ?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Dim MyApp As Object
Set MyApp = CreateObject("Word.Application")
MyApp.Visible = True
MyApp.Documents.Open FileName:="C:\data\gems.doc", ConfirmConversions:=False, ReadOnly:=False
Set MyApp = Nothing
rouxjeanAuthor Commented:
It still pops the message !
u have to write code to handle the error.
check for its attributes wheteher it is a read only or anything.. then you can handle the error.
you can use the filesystemobject implementing this.

whenever u open a word doc, and some other opens it  lock the file and second application get it as a read only warning.
set mydoc visible
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.