| re: Opening a Word doc with Access
"Jim" <google@whatifcomputers.com> wrote in message
news:zfNmc.61923$302.44519@newssvr25.news.prodigy. com...[color=blue]
> I'm trying to use Word to generate mailings for an Access project.
> I want to automate from the access side.
> I'm trying to open and print a file called mydocs
>
> I'm having trouble opening the document....let alone printing.
> here's what I have so far:
>
> Dim MyDoc As Object
> Dim oApp As Object
>
> Set oApp = CreateObject("Word.Application")
> oApp.Visible = True
>
> Set MyDoc = GetObject("MyDoc.doc", "Word.Document")
> MyDoc.Visible = True
>
> I've tried putting in the full path with the same result.
> Any Ideas?
>
> Thanks in advance[/color]
This is some code I used for PowerPoint - the same approach should work for
Word. I'm not sure what you are doing wrong, I basically found something
like this in the archives and customized it for my app. But whether the
syntax for your code above contains an error, I do not know.
Dim oPPT As PowerPoint.Application
On Error Resume Next 'Grab PowerPoint if it's already running
Set oPPT = Nothing 'Releases the object if it had been already
assigned
Set oPPT = GetObject(, "PowerPoint.Application")
Err.Clear
On Error GoTo Err_Command_Run_Get_Fund_Sheet_Info_Click
If oPPT Is Nothing Then 'not already running
Set oPPT = CreateObject("PowerPoint.Application")
oPPT.Visible = msoTrue
oPPT.WindowState = ppWindowMinimized
End If |