[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1074
  • Last Modified:

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 !
0
rouxjean
Asked:
rouxjean
  • 4
  • 2
1 Solution
 
shivsaCommented:
Dim MyDoc As Word.Application
     
    Set MyDoc = CreateObject("Word.Application")
    MyDoc.Documents.Open "c:\TP2\facture.doc"
    MyDoc.Visible = True

---------------------
0
 
shivsaCommented:
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
 
rouxjeanAuthor Commented:
Thx :)
and how about the warning message ?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
shivsaCommented:
------------------------------
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
 
rouxjeanAuthor Commented:
It still pops the message !
0
 
shivsaCommented:
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
 
sonikthomasCommented:
set mydoc visible
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now