473,722 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP...Exportin g/Extracting an Access OLE object (Word document) to a Word document file

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 is that I would like to export/extract it
to a Word document with a name that is stored in one of the other
fields of that record. I would also like to append a date timestamp
(YYYYMMDDHHMMSS ) to the Word documents name just in case the name
field is not unique.

For example:

NAME DOCUMENT
docNameA Microsoft Word Document
docNameB Microsoft Word Document
docNameB Microsoft Word Document

The above table contains two fields, NAME = text datatype and DOCUMENT
= OLE object datatype. I would like loop through the 3 records and
create 3 Word documents with the names of docNameA2004070 8135601,
docNameB2004070 8135723 and docNameB2004070 8135724 respectively. Now
that I think of it, I guess I would have to build into the script a
second delay to ensure unique document names.

Anyway, your help with either example code or a point in the right
direction will be tremendously appreciated!
Nov 13 '05 #1
4 15849
Otis please stop multiposting. Instead crosspost to all of the relevant
NG's at one time.

A quick search on GoogleGroups would have yielded the desired solution
based on Word Automation from within Access. Here is a sample post:

From: Alick [MSFT] (al***@online.m icrosoft.com)
Subject: RE: Convert ole from embedded to linked
View this article only
Newsgroups: microsoft.publi c.access.module sdaovba
Date: 2003-11-26 04:19:48 PST
Hi Jeff,

We need to save the embedded object to a file and then relink the
object.
The saving code will like:

Dim NewDoc As String
DocPath = "c:\worddoc.doc "
With Me.OLEObject
.Class = "Word.Docum ent"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Applica tion.Documents. Item(1).SaveAs DocPath
.Object.Applica tion.Quit
.Action = acOLEClose

End With

Please feel free reply to the threads if you have any questions or
concerns.
Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft. com/security>

This posting is provided "AS IS" with no warranties, and confers no
rights.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Otis Hunter" <ju*******@yaho o.com> wrote in message
news:2a******** *************** **@posting.goog le.com...
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 is that I would like to export/extract it
to a Word document with a name that is stored in one of the other
fields of that record. I would also like to append a date timestamp
(YYYYMMDDHHMMSS ) to the Word documents name just in case the name
field is not unique.

For example:

NAME DOCUMENT
docNameA Microsoft Word Document
docNameB Microsoft Word Document
docNameB Microsoft Word Document

The above table contains two fields, NAME = text datatype and DOCUMENT
= OLE object datatype. I would like loop through the 3 records and
create 3 Word documents with the names of docNameA2004070 8135601,
docNameB2004070 8135723 and docNameB2004070 8135724 respectively. Now
that I think of it, I guess I would have to build into the script a
second delay to ensure unique document names.

Anyway, your help with either example code or a point in the right
direction will be tremendously appreciated!


Nov 13 '05 #2
"Stephen Lebans" <Fo************ *************** *************@l invalid.com> wrote in message news:<EP******* **************@ ursa-nb00s0.nbnet.nb .ca>...
Otis please stop multiposting. Instead crosspost to all of the relevant
NG's at one time.

A quick search on GoogleGroups would have yielded the desired solution
based on Word Automation from within Access. Here is a sample post:

From: Alick [MSFT] (al***@online.m icrosoft.com)
Subject: RE: Convert ole from embedded to linked
View this article only
Newsgroups: microsoft.publi c.access.module sdaovba
Date: 2003-11-26 04:19:48 PST
Hi Jeff,

We need to save the embedded object to a file and then relink the
object.
The saving code will like:

Dim NewDoc As String
DocPath = "c:\worddoc.doc "
With Me.OLEObject
.Class = "Word.Docum ent"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Applica tion.Documents. Item(1).SaveAs DocPath
.Object.Applica tion.Quit
.Action = acOLEClose

End With

Please feel free reply to the threads if you have any questions or
concerns.
Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft. com/security>

This posting is provided "AS IS" with no warranties, and confers no
rights.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Otis Hunter" <ju*******@yaho o.com> wrote in message
news:2a******** *************** **@posting.goog le.com...
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 is that I would like to export/extract it
to a Word document with a name that is stored in one of the other
fields of that record. I would also like to append a date timestamp
(YYYYMMDDHHMMSS ) to the Word documents name just in case the name
field is not unique.

For example:

NAME DOCUMENT
docNameA Microsoft Word Document
docNameB Microsoft Word Document
docNameB Microsoft Word Document

The above table contains two fields, NAME = text datatype and DOCUMENT
= OLE object datatype. I would like loop through the 3 records and
create 3 Word documents with the names of docNameA2004070 8135601,
docNameB2004070 8135723 and docNameB2004070 8135724 respectively. Now
that I think of it, I guess I would have to build into the script a
second delay to ensure unique document names.

Anyway, your help with either example code or a point in the right
direction will be tremendously appreciated!


Please excuse my cross post - I posted to just one group and I did not
get a response so today I posted to other groups. What is the proper
way I should go about getting a response to 1 post when it isn't clear
the exact right group to post to? Anyway, please except my apology.
I also have spent over 3 hours trying to find a post that would answer
my question before I posted and I did not get satisfaction - I really
did try to be created with my searches. Bottom line, thank you for
your help!
Nov 13 '05 #3
No need to apologize Otis. Just remember to cross post to mulitple
groups within a single post rather than posting a single message
individually to multiple groups.

If you search on GoogleGroups you will find several threads on how to
save embedded Word docs to seperate files.

Good Luck.
:-)
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Otis Hunter" <ju*******@yaho o.com> wrote in message
news:2a******** *************** **@posting.goog le.com...
"Stephen Lebans"

<Fo************ *************** *************@l invalid.com> wrote in
message news:<EP******* **************@ ursa-nb00s0.nbnet.nb .ca>...
Otis please stop multiposting. Instead crosspost to all of the relevant NG's at one time.

A quick search on GoogleGroups would have yielded the desired solution based on Word Automation from within Access. Here is a sample post:

From: Alick [MSFT] (al***@online.m icrosoft.com)
Subject: RE: Convert ole from embedded to linked
View this article only
Newsgroups: microsoft.publi c.access.module sdaovba
Date: 2003-11-26 04:19:48 PST
Hi Jeff,

We need to save the embedded object to a file and then relink the
object.
The saving code will like:

Dim NewDoc As String
DocPath = "c:\worddoc.doc "
With Me.OLEObject
.Class = "Word.Docum ent"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Applica tion.Documents. Item(1).SaveAs DocPath
.Object.Applica tion.Quit
.Action = acOLEClose

End With

Please feel free reply to the threads if you have any questions or
concerns.
Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft. com/security>

This posting is provided "AS IS" with no warranties, and confers no
rights.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Otis Hunter" <ju*******@yaho o.com> wrote in message
news:2a******** *************** **@posting.goog le.com...
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 is that I would like to export/extract it to a Word document with a name that is stored in one of the other
fields of that record. I would also like to append a date timestamp (YYYYMMDDHHMMSS ) to the Word documents name just in case the name
field is not unique.

For example:

NAME DOCUMENT
docNameA Microsoft Word Document
docNameB Microsoft Word Document
docNameB Microsoft Word Document

The above table contains two fields, NAME = text datatype and DOCUMENT = OLE object datatype. I would like loop through the 3 records and
create 3 Word documents with the names of docNameA2004070 8135601,
docNameB2004070 8135723 and docNameB2004070 8135724 respectively. Now that I think of it, I guess I would have to build into the script a second delay to ensure unique document names.

Anyway, your help with either example code or a point in the right
direction will be tremendously appreciated!


Please excuse my cross post - I posted to just one group and I did not
get a response so today I posted to other groups. What is the proper
way I should go about getting a response to 1 post when it isn't clear
the exact right group to post to? Anyway, please except my apology.
I also have spent over 3 hours trying to find a post that would answer
my question before I posted and I did not get satisfaction - I really
did try to be created with my searches. Bottom line, thank you for
your help!


Nov 13 '05 #4
"Stephen Lebans"
<Fo************ *************** *************@l invalid.com> wrote in
news:39******** *************@u rsa-nb00s0.nbnet.nb .ca:
If you search on GoogleGroups you will find several threads on how
to save embedded Word docs to seperate files.


But has anyoned figured out a way to extract programmaticall y files
that are of different types? I had a database once that had Word,
Excel and PowerPoint files in it. I could never figure out how to
programmaticall y figure out which kind of file it was so that it
could be saved out to the file system.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #5

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

Similar topics

0
3363
by: Otis Hunter | last post by:
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...
8
6991
by: chippy | last post by:
Hi, I've a VB script that creates a Access object in a word doc. Here is the full script. It works for all but the Export. Which always fails with a 3011 error. If I do the same in Access as a straight Macro or script it works. Add it as an object and it won't work. HELP.
2
3187
by: Claus - Arcolutions | last post by:
I got a word document as a stream, and I want to get the text from the word document. But I cant seem to find anything to use for that purpose. The "Microsoft office ?.object" com reference, only include functionality to read from a file (as far as I know). I looked a little on the structure of the document, but it doesnt seem to have any common structures, especially not if you compare from different office versions.
3
1249
by: Michael | last post by:
Does anyone know how to export a data grid from asp.net into microsoft access? Thanks. Michael
2
2471
by: zheng | last post by:
ÇçÌì I have a word document and it has a picture object, I want save the picture object as other single picture file by C# program. I have a idea, by clipboard, copy the picture to clipboard, and then save as a file from clipboard, it is work well in application,but don't work in a web application. how can I to do? and are there other ideas to save the picture object in web application? help me !!
0
1247
by: sebnunes | last post by:
Hi all, I know this problem has been discussed many times but I've read different post about this problem and none could answer mine. I'm trying to use Word automation from an asp .net web page. I have the classic error Access Denied when the Word application object is instantiated. I have, as suggested in different posts, added the aspnet user to the
1
5056
by: kayberrie | last post by:
I want to write a VBA mail merge code. I want to link the code/macro/dohicky to a nifty little button so it makes life easy. I think I can handle the button part, the code part - not so much. I know very little (actually probably nothing) about VBA and I'm currently learning my way around Access. Basically, I want to click a button in the form that merges the letter for me, only for the one record I'm currently viewing..not the whole...
7
4014
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
4
9168
by: Dave Smith | last post by:
I’ve read a lot of different article on the internet about being able to export a table from MS Access to Ms Excel. Problem I’m having is that I don’t know which one would work best for me, so I thought since I’ve gotten such great advice from this form I will ask. I have a query that updates a table in access. What I would like to have happen in the export from access to excel Currently I have a number of queries that updates number...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
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
6681
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
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
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
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
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
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.