Solved

Opening Word document

Posted on 2003-12-07
7
1,071 Views
Last Modified: 2010-05-03
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 !
0
Comment
Question by:rouxjean
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 24

Expert Comment

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

---------------------
0
 
LVL 24

Accepted Solution

by:
shivsa earned 500 total points
ID: 9892529
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
0
 

Author Comment

by:rouxjean
ID: 9892828
Thx :)
and how about the warning message ?
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 24

Expert Comment

by:shivsa
ID: 9892920
------------------------------
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
------------------------------
0
 

Author Comment

by:rouxjean
ID: 9893071
It still pops the message !
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9893425
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.
0
 
LVL 1

Expert Comment

by:sonikthomas
ID: 9895176
set mydoc visible
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question