473,385 Members | 1,409 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,385 software developers and data experts.

HELP...Exporting/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 docNameA20040708135601,
docNameB20040708135723 and docNameB20040708135724 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 15766
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.microsoft.com)
Subject: RE: Convert ole from embedded to linked
View this article only
Newsgroups: microsoft.public.access.modulesdaovba
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.Document"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Application.Documents.Item(1).SaveAs DocPath
.Object.Application.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*******@yahoo.com> wrote in message
news:2a*************************@posting.google.co m...
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 docNameA20040708135601,
docNameB20040708135723 and docNameB20040708135724 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****************************************@linval id.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.microsoft.com)
Subject: RE: Convert ole from embedded to linked
View this article only
Newsgroups: microsoft.public.access.modulesdaovba
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.Document"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Application.Documents.Item(1).SaveAs DocPath
.Object.Application.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*******@yahoo.com> wrote in message
news:2a*************************@posting.google.co m...
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 docNameA20040708135601,
docNameB20040708135723 and docNameB20040708135724 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*******@yahoo.com> wrote in message
news:2a*************************@posting.google.co m...
"Stephen Lebans"

<Fo****************************************@linval id.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.microsoft.com)
Subject: RE: Convert ole from embedded to linked
View this article only
Newsgroups: microsoft.public.access.modulesdaovba
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.Document"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Application.Documents.Item(1).SaveAs DocPath
.Object.Application.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*******@yahoo.com> wrote in message
news:2a*************************@posting.google.co m...
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 docNameA20040708135601,
docNameB20040708135723 and docNameB20040708135724 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****************************************@linval id.com> wrote in
news:39*********************@ursa-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 programmatically 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
programmatically 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
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...
8
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...
2
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...
3
by: Michael | last post by:
Does anyone know how to export a data grid from asp.net into microsoft access? Thanks. Michael
2
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...
0
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...
1
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...
7
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();...
4
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.