[AccessD] Access/Word Interaction

Steve Goodhall sgoodhall at comcast.net
Sat Aug 2 08:49:07 CDT 2003


BerichtThis should do what you want

Regards,

Steve Goodhall
Senior Project Manager
Compuware Corporation


Option Compare Database
Option Explicit

Sub TestWordOne()
Dim oWOrd As Word.Application, oDoc As Word.Document
Set oWOrd = New Word.Application
oWOrd.Visible = True
Set oDoc = oWOrd.Documents.Add
SJGMsgBox "Click on OK to save and close Word document", vbOKOnly
oDoc.SaveAs DBLocation & "testone.doc"
oDoc.Close False
oWOrd.Quit False
End Sub

Sub TestwordTwo()
Dim oDoc As Word.Document
Set oDoc = New Word.Document
oDoc.Application.Visible = True
SJGMsgBox "Click on OK to save and close Word document", vbOKOnly
oDoc.SaveAs DBLocation & "testtwo.doc"
oDoc.Application.Quit False
End Sub

Function SJGMsgBox(sPrompt As String, Optional lButtons As Long = vbOK, _
    Optional sTitle As String = "Steve Goodhall's Timed Message Box",
Optional lDelay = 0)
Dim lResult As Long, oShell As WshShell
Set oShell = New WshShell
lResult = oShell.PopUp(sPrompt, lDelay, sTitle, lButtons)
SJGMsgBox = lResult
Set oShell = Nothing
End Function

Function DBLocation() As String
Dim sDBLoc As String, lPos As Long
sDBLoc = CurrentDb.Name
lPos = InStrRev(sDBLoc, "\")
sDBLoc = Left(sDBLoc, lPos)
DBLocation = sDBLoc
End Function

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Michael Brösdorf
Sent: Friday, August 01, 2003 9:33 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Access/Word Interaction


  Dear group,

  I have an Access application that creates a MS Word document and inserts
some text into it and makes it visible (so that users can start working with
it right away).
  When that process is finished I want to inform the user with a MsgBox.
  The problem is, that this activates MS Access (my application), but I want
the Word-Dokument to stay active.

  Is there something like WordObj.application.Msgbox?


  TIA,

  Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030802/00b9af1b/attachment-0001.html>


More information about the AccessD mailing list