Re: Inserting OLE Bitmap into Word document

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Stephen

I'm playing with that code you pointed me to but I'm having difficulties
with it.

Access is telling me it doesn't recognise the variable type tagOPENFILENAME,
an instance of which is created by the function ahtCommonFileOpenSave. Is
there a class declaration somewhere I need, or do I need to add a reference
to some library or other?

Also, will this code be portable across different versions of Windows?

Thanks again

David

"Stephen Lebans" wrote:

> The OLE Frame control has an Action method that allows you to ask it to
> copy its contents to the Clipboard.
>
> Your current course of action is the suggested method for displaying
> Images. A method to call the standard WIndows File Dialog is here:
> http://www.mvps.org/access/api/api0001.htm
>
> It looks complicated but the code is well tested.
>
> --
>
> HTH
> Stephen Lebans
> http://www.lebans.com
> Access Code, Tips and Tricks
> Please respond only to the newsgroups so everyone can benefit.
>
>
> "David Cleave" <DavidCleave@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:198D51C5-C1C3-41C5-9DDD-FBA2E3D281BC@xxxxxxxxxxxxxxxx
> > I never found a way to programmatically copy field values from Access
> onto
> > the clipboard.
> >
> > I solved this problem by ditching OLE fields altogether, and using a
> text
> > field to store the path of the image instead. I worked out how to get
> Access
> > to show the image in a form, even though it was only storing the path.
> The
> > path could then be used as an argument for Word's AddPicture method.
> I'm
> > quite happy with this solution.
> >
> > One thing that would make all this better is if I could provide the
> user
> > with a dialogue box which they can use to point Access to the filename
> of the
> > picture, instead of them having to type a filename in. Do you know of
> any way
> > I can get Access to prompt the user for a filename using a standard
> Windows
> > file dialogue?
> >
> > Thanks
> >
> > David
> >
> > "Stephen Lebans" wrote:
> >
> > > I'm just heading out the door to work but it certainly is possible.
> As
> > > you mentioned, the Clipboard route is probably the simplest
> solution.
> > > You can programmatically copy the contents of the OLE field to the
> > > Clipboard, setfocus to the Word App, Paste the current contents of
> the
> > > Clipboard, continue to loop through your records.
> > >
> > > Alternatively, you can export the contents of the OLE field to a
> disk
> > > based Jpeg file and then insert the Jpegs into the Word doc. The
> > > solution can be code to work at runtime as requried or export the
> entire
> > > table at once.
> > >
> > > --
> > >
> > > HTH
> > > Stephen Lebans
> > > http://www.lebans.com
> > > Access Code, Tips and Tricks
> > > Please respond only to the newsgroups so everyone can benefit.
> > >
> > >
> > > "David Cleave" <DavidCleave@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> message
> > > news:DE71E48D-1241-4226-8FD7-2E0E9E88D543@xxxxxxxxxxxxxxxx
> > > > Hi Stephen. Thanks for asking.
> > > >
> > > > I'm come to the conclusion that it is not possible to use VB to
> insert
> > > the
> > > > contents of an OLE field into a Word document. However, it is
> possible
> > > to
> > > > change the field to contain a pathname for the object, and use
> this
> > > pathname
> > > > to place the object into a Word document.
> > > >
> > > > Cheers
> > > >
> > > > David
> > > >
> > > > "Stephen Lebans" wrote:
> > > >
> > > > > David have you worked through your issues yet?
> > > > >
> > > > > --
> > > > >
> > > > > HTH
> > > > > Stephen Lebans
> > > > > http://www.lebans.com
> > > > > Access Code, Tips and Tricks
> > > > > Please respond only to the newsgroups so everyone can benefit.
> > > > >
> > > > >
> > > > > "David Cleave" <DavidCleave@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> > > message
> > > > > news:7A7497E8-62F2-45A5-A25F-915411240F8A@xxxxxxxxxxxxxxxx
> > > > > > Hi all
> > > > > >
> > > > > > IÃf¢?Tm writing a routine which opens a new Word document and
> > > sticks
> > > > > content
> > > > > > from the current record into it. I want to put an OLE Bitmap
> from
> > > the
> > > > > current
> > > > > > record into the Word document. I am having trouble doing this.
> I
> > > have
> > > > > thought
> > > > > > of three possible ways to do this. Please advise me on them!
> > > > > >
> > > > > > WordÃf¢?Ts ActiveDocument.Shapes.AddPicture method requires a
> > > filename.
> > > > > Is there
> > > > > > a filename associated with an OLE field in Access, and can I
> get
> > > to
> > > > > it?
> > > > > >
> > > > > > Alternatively, Word provides a method to paste the contents of
> the
> > > > > clipboard
> > > > > > into the document. Does Access provide any means to copy a
> field
> > > value
> > > > > onto
> > > > > > the clipboard?
> > > > > >
> > > > > > Lastly, I could use a field in the table to store the filename
> of
> > > the
> > > > > bitmap
> > > > > > instead of storing it as OLE (enabling me to use Word's
> AddPicture
> > > > > method).
> > > > > > If I did this, is there a way I could get Access to display
> the
> > > > > picture
> > > > > > itself when the record is viewed, rather than just the
> filename?
> > > > > >
> > > > > > Thanks again
> > > > > >
> > > > > > David
> > > > >
> > > > >
> > >
> > >
>
>
.



Relevant Pages

  • Re: Inserting OLE Bitmap into Word document
    ... The OLE Frame control has an Action method that allows you to ask it to ... copy its contents to the Clipboard. ... instead of them having to type a filename in. ... >> You can programmatically copy the contents of the OLE field to the ...
    (microsoft.public.access.formscoding)
  • Re: Inserting OLE Bitmap into Word document
    ... Clipboard, setfocus to the Word App, Paste the current contents of the ... you can export the contents of the OLE field to a disk ... > contents of an OLE field into a Word document. ... >>> a filename associated with an OLE field in Access, ...
    (microsoft.public.access.formscoding)
  • Re: Inserting OLE Bitmap into Word document
    ... "Stephen Lebans" wrote: ... the Clipboard route is probably the simplest solution. ... you can export the contents of the OLE field to a disk ... >> contents of an OLE field into a Word document. ...
    (microsoft.public.access.formscoding)
  • Re: Copying objects to clipboard
    ... Some months ago I posted a script to c.l.t which uses TWAPI to do that sort ... that the filename will be pure ASCII, you can use this script as is, like ... # There can be several types data in the clipboard so we have to ... If the filename isn't ASCII or you want to pick up more than one filename, ...
    (comp.lang.tcl)
  • RE: automate reports -- copy to clipboard
    ... clipboard, so I guess I'll keep searching. ... You might write the string on Visio drawin and select text in edit mode. ... Dim doc As Visio.Document ... Dim FileName As String ...
    (microsoft.public.visio.developer.vba)