By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,477 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,477 IT Pros & Developers. It's quick & easy.

Exporting Pictures to .rtf

P: n/a
Hello,

I have an ole object in my database that contains mostly pictures. I
have this field in a report that I need to export to MS Word. When I
export the report, I get everything accept the picture. What am I
doing wrong?

Thanks,Lisa
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You're not doing anything wrong: Access doesn't export pictures to .rtf. (My
understanding is that there are different "levels" of .rtf, and Access uses
the lowest level, so as to be most compatible).

If you don't need to be able to update the .rtf files, check what Stephen
Lebans has at http://www.lebans.com/ReportUtilities.htm

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Lisa" <ln********@citlink.net> wrote in message
news:14**************************@posting.google.c om...
Hello,

I have an ole object in my database that contains mostly pictures. I
have this field in a report that I need to export to MS Word. When I
export the report, I get everything accept the picture. What am I
doing wrong?

Thanks,Lisa

Nov 12 '05 #2

P: n/a
Nothing

For some unknown reason Access does not export graphic elements of a report
to RTF.

"Lisa" <ln********@citlink.net> wrote in message
news:14**************************@posting.google.c om...
Hello,

I have an ole object in my database that contains mostly pictures. I
have this field in a report that I need to export to MS Word. When I
export the report, I get everything accept the picture. What am I
doing wrong?

Thanks,Lisa

Nov 12 '05 #3

P: n/a
This is doable but coding intensive. After you pass your data in RTF
format, you need to add bookmarks to where you want to place your
pictures. This is the easy part. You can do this with automation:
Here is some sample code for the Word VBA part that you can do from
Access:

Selection.HomeKey Unit:=wdStory
Selection.MoveDown Unit:=wdLine, Count:=28
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="pic"

You have to make a reference to the Word Library (goto Tools References
in any code module in Access) then create some vars like Dim wrdObj as
Word.Application, wrdDoc as Word.Document

Set wrdObj = CreateObject("Word.Application")
Set wrdDoc = wrdObj.Documents.Open("C:\somedoc.doc")
wrdDoc.Selection...

After you add the bookmarks, then you have to copy the respective
picture to memory and paste it in word at the corresponding bookmark.
The copy the picture part is the hard part. You could use API code
(quite cumbersome) or you could write an ActiveX control in VB6 (an OCX
or ActiveX Dll) which uses VB's copymode (not available in Access for
some reason). This is actually simpler than using the API code (because
I don't have the API code to copy a picture, just text).

Either way, if you are passing data in RTF format to Word, passing
pictures won't be fun. Another thing you could do is to create a
Template like Word Doc and plant a bunch of bookmarks on it, then pass
the data through Automation, wrdObj, wrdDoc. You could actually write
the code modules in the Word Document and invoke them from wrdDoc

wrdDoc.Application.Run "DataTransfer"

Say your Word subroutine is called "DataTransfer". You coudl use an ADO
or DAO recordset to populate the document and use an Image control
inside the Word Doc to display your images. This would really be a more
realistic approach if you really need to have pics in your doc.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #4

P: n/a
You might want to investigate XpertDoc as an alternative solution. It
creates genuine MS-Word documents without making any call to the
MS-Word application, making it more reliable, much faster and easier
to deploy and support.

The easiest way to get the picture from your database to the word
document through the XpertDoc template is to save the picture on disk
and create a link to it using the following procedure:

1. Create an XpertDoc Expression (a "blue" field).

2. In the "Code" section, put the following expression:
XdInsertPictureLinkRTF(<picture file path>)
For example: XdInsertPictureLinkRTF("C:\YourPicsFolder\YourPicN ame.jpg")

3. Change the format of the XD Expression to "RTF" (using the "Format"
combo
box that lies below the "Code" section).

You can download this tool from www.xpertdoc.com.
Rich P <rp*****@aol.com> wrote in message news:<3f*********************@news.frii.net>...
This is doable but coding intensive. After you pass your data in RTF
format, you need to add bookmarks to where you want to place your
pictures. This is the easy part. You can do this with automation:
Here is some sample code for the Word VBA part that you can do from
Access:

Selection.HomeKey Unit:=wdStory
Selection.MoveDown Unit:=wdLine, Count:=28
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="pic"

You have to make a reference to the Word Library (goto Tools References
in any code module in Access) then create some vars like Dim wrdObj as
Word.Application, wrdDoc as Word.Document

Set wrdObj = CreateObject("Word.Application")
Set wrdDoc = wrdObj.Documents.Open("C:\somedoc.doc")
wrdDoc.Selection...

After you add the bookmarks, then you have to copy the respective
picture to memory and paste it in word at the corresponding bookmark.
The copy the picture part is the hard part. You could use API code
(quite cumbersome) or you could write an ActiveX control in VB6 (an OCX
or ActiveX Dll) which uses VB's copymode (not available in Access for
some reason). This is actually simpler than using the API code (because
I don't have the API code to copy a picture, just text).

Either way, if you are passing data in RTF format to Word, passing
pictures won't be fun. Another thing you could do is to create a
Template like Word Doc and plant a bunch of bookmarks on it, then pass
the data through Automation, wrdObj, wrdDoc. You could actually write
the code modules in the Word Document and invoke them from wrdDoc

wrdDoc.Application.Run "DataTransfer"

Say your Word subroutine is called "DataTransfer". You coudl use an ADO
or DAO recordset to populate the document and use an Image control
inside the Word Doc to display your images. This would really be a more
realistic approach if you really need to have pics in your doc.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.