473,324 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Opening a Word doc with Access

Jim
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

Jim
Nov 12 '05 #1
2 2681
"Jim" <go****@whatifcomputers.com> wrote in message news:<zf*******************@newssvr25.news.prodigy .com>...
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

Jim


shouldn't that be something like
oApp.Open("C:\PathToDoc\MyDoc.doc")
Nov 12 '05 #2
"Jim" <go****@whatifcomputers.com> wrote in message
news:zf*******************@newssvr25.news.prodigy. com...
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


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
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: Carlos Andr?s | last post by:
Hi everybody. I've got a problem. I'd like to avoid opening a new window when you have pressed the shift key and you click in the left button of the mouse. I've tried the next solution, in the...
3
by: Mike Wilson | last post by:
Is there a way to open an OLE DB database from within Access? I would like to use the Access GUI with its table and query explorer to examine a database only available through an OLEDB provider...
1
by: Andy Davis | last post by:
Hi I've written the following code for a button on a form to open a mail merge document in MS Word. The code opens the document fine but does not display the usual connection details to open the...
3
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
11
by: Danny J. Lesandrini | last post by:
Has anyone else noticed this? I searched group archives and found nothing, but it's really starting to irritate me big time. Here's the steps to reproduce the problem: Copy something to the...
4
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
3
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
2
by: BerkshireGuy | last post by:
I want to open a word document from an Access form and transfer data from the Access form to the Word Document. For instance, if a user clicks an option box on my access form, I want to pass...
8
by: ljungers | last post by:
Wondering if somone knows how to open a Access report in Word or export it to Word. Currently I'm opening and printing a report using VBA with the following command (DoCmd.OpenReport "TheReportName",...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.