Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Interacting with a Word document...

Posted on 1999-07-23
Medium Priority
Last Modified: 2010-04-30
The goal: to launch Word from VB, open a specific template, have the user edit the new document, close Word (or return to the VB app, and have the app go pick up the document for emailing.

I know how to launch Word and how to pick up the document but I have two questions remaining.
1.  Is there a way to make Word modal (return control to the app after the user has fininshed editing the document)?
2.  How do I name the document with a predetermined name and save it without user control so that after they finish editing the document, the document is already named and now just has to be closed with a close/save command?

Any help would be appreciated.
Question by:svfafel
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
LVL 13

Expert Comment

ID: 1526913
Word Modal. No hardly possible

Assuming your code looks like
Dim modapp as new Word.Application
Set mmdoc = modapp.Documents.Open("c:\temp\xxx.doc", True)

Also take a look at the OLE1 control

LVL 13

Expert Comment

ID: 1526914
Comments please??
LVL 13

Accepted Solution

Mirkwood earned 400 total points
ID: 1526915
My answers were correct sorry.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 1526916
Mirkwood, sorry for not commenting sooner.
My code is like this:
    Dim objWord As Word.Application
    On Error Resume Next
    Set objWord = Nothing
    Set objWord = GetObject(, "Word.application")
    If objWord = "" Then   'error
        Set objWord = CreateObject("Word.Application")
    End If
    objword.Documents.Add ("c:\my documents\")
    objword.Visible = True
When i use the "objword.documents.add(TEMPLATE NAME)" it creates a Document1 in Word.  I want to name this document (c:\temp\tempdoc.doc) and save it in that location without user interaction BEFORE the user begins to edit it.  After they edit the document they will close Word (or the document) and my app will go pick it up (tempdoc.doc).  The naming and saving (without user interaction) is what i need help on.
LVL 13

Expert Comment

ID: 1526917
Dim worddoc as word.document
set worddoc = objword.Documents.Add ("c:\my documents\
worddoc.saveas ...

Author Comment

ID: 1526918
sorry for the delay....had a baby! (boy #2)

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

715 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