473,756 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I need help from VB/VBS experts: exporting Access OLE object (Word document) to a file

I have been fighting with this for days and your expert help is
needed! Below is the code I am executing which results with "Object
doesn't support this property or method". The error is occuring on
the "With Me.OLEObject" line. I am trying to extract a Word
document(OLE object) from an Access database, for each record in the
table, and save it as a Word Document. The 4th field of each record
is a OLE object type.

I may be getting my terms mixed up (i.e. VB, VBScript and VBA). I
just want to execute a program from the windows shell or from within
Access which will loop through all the records of the said table and
create 1 Word Document file per database record using the OLE object
field as the source.

This is a continuation of my recent post "Exporting/Extracting an
Access OLE object (Word document) to a Word document file" in several
newsgroups. Example code will be greatly appreciated - please
indicate if it is VB, VBS or VBA code.

Thank you for your help!

My Code:

dim conn
set conn = CreateObject("A DODB.Connection ")
conn.Open "provider=micro soft.jet.oledb. 4.0;data
source=C:\work\ srvScripts.mdb"

dim rs
dim NewDoc
set rs = CreateObject("A DODB.Recordset" )
'rs.Open "select * from tblTemp", conn
rs.Open "tblTemp", conn

'rs.BOF and rs.EOF = True means that there is no records

rs.MoveFirst
while not rs.EOF
set srv = rs.Fields(1)
set ttl = rs.Fields(2)
NewDoc = "c:\tst\" & srv & "." & date() & "." & ttl & ".doc"
' WScript.Echo NewDoc
oObj = rs.Fields(3) ' rs.Fields(3) is a OLE object field
oObj.Class = "Word.Docum ent"
oObj.Verb = acOLEVerbOpen
oObj.Action = acOLEActivate
oObj.Object.App lication.Docume nts.Item(1).Sav eAs NewDoc
oObj.Object.App lication.Quit
oObj.Action = acOLEClose
End With

rs.MoveNext
wend
Nov 13 '05 #1
0 3365

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

Similar topics

5
2694
by: Fly Girl | last post by:
Gurus needed! I'm trying to use a Word class object in order to capture events in Word. Here's what I have, but the event code appWord_BeforeDocumentSave... doesn't ever fire. In a Class Module +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Public WithEvents appWord As Word.Application Public WithEvents docWord As Word.Document Public Sub appWord_DocumentBeforeSave(ByVal Doc As Word.Document,
2
1687
by: ASIF | last post by:
Does anyone klnow of a quick way of exporting data from access to a text doucument, the data needs to be tab seperated, and the data to be exported needs to be selected using parameter queries. I am currently using FSOs and inserting a tab character between each field an writing th data to the text file one line at a time. Thanks for your help Asif
20
1972
by: Stephan Golux | last post by:
It seems I have run afoul of an unfixable and acknowledged bug in my beloved access 97 which has no workaround other than to upgrade. Current supported upgrades are 2002 and 2003. 2003 appears to use lots 'o system resources, so I am wondering if I am best to go with the older (2002) version. Any opinions out here? In particular, which version more likely to make the conversion of the 97 databases the least painful? Both upgrades
4
15854
by: Otis Hunter | last post by:
I have been given an Access Database which contains a table that has an OLE object field that contains a Word document. That table contains hundreds of records. I would like to find out how I can write a VB script, to be executed either within Access or executed at the CMD prompt, which will loop through all the records and open the document object and save it to a Word document that I can access from Windows Explorer. An additional info...
5
3086
by: feck | last post by:
Hi, Is there any code/routine to export a report as a word document retaining the formatting. I have a requirment to produce some fairly detailed statisitical reports for transmission by e-mail. The reports require tweaking on a regular basis so I do not really want to base a standard document on query data, but would prefer to redesign the report as required and export that on completion. I know I can save as rtf etc. but you lose all...
1
1819
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 table in my database when the file is opened.i.e: "Opening this document will run the following SQL command: SELECT * FROM 'filename' " Hence all that is opened is a document with no updated details from the source table. If I open the document...
1
1551
by: Thankful Idiot via AccessMonster.com | last post by:
I was wondering if anyone knew anything about exporting data to ms word documents. I have a program that can gather data such as customer addresses, and would like to move it to a ms word document in our shipment request format. Any ideas? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200508/1
0
1346
by: NETRavi | last post by:
HI, For one of our ASP.NET project we are generating a business graph using a crystalreportviewer. The crystalreportviewer gives the possibility of exporting to .htm, .doc, . xls, .pdf, .rtf. Our requirement is exporting to powerpoint presentation which is not available. So we are exporting first to word document and then there should be some code/tool to convert word document to powerpoint presentation.
2
2871
by: Mux | last post by:
I am facing the following problem while exporting data to Word. The current implementation is as described below: I have a JSP file which has a link that enables you to export the data to Word. Clicking on the link invokes a javascript function: function showRTF() { var newWin = window.open("", "newWin","width=900,height=800%,scrollbars=yes,menubar=yes,resizable=yes,too
0
9455
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.