Storing OLE Objects In MSAccess Database 
Author Message
 Storing OLE Objects In MSAccess Database

I have a programming problem, that I'm kinda stuck on.

Application:  Visual Basic Pro 5.0 application driving a MSAccess database
to store graphic images with a keyword search capability.

I designed an Access97 database with some OLE object fields in it.  I can
manually cut and paste objects into it, no problem.  What I'm trying to do
is (through VBA code) stuff PowerPoint97 Slide objects into the database (I
can manually insert them with the Insert Object command).

Below is code I'm using to build a PowerPoint presentation out of bitmaps
(the database has pointers to the original bitmap files stuck in a
ShowFileName array).

Once I create the PPT slide, I want to stuff it into the OLE field in the
database (so the client can assign keywords to it, etc.).  I've opened a
recordset object, and done a rsGraphics.AddNew, set the keyfield values, but
when I try to do a:

    rsGraphics!([GraphicOLE Field]) = PPTCurrentSlide   'PPTCurrentSlide is
object in code below

I get an Object doesn't support something or other error message.  I haven't
really every had to manipulate OLE objects into and out of my databases, so
I'm kinda stuck on the syntax of how to stuff objects into OLE fields.

Anybody know how?

Private Sub BuildShow()
    Dim PPT As Object
    Dim PPTPres As Object
    Dim PPTCurrentSlide As Object

    Set PPT = CreateObject("PowerPoint.Application")
        Set PPTPres = PPT.Presentations.Add(True)
            For i = 1 To ShowFileName.UBound + 1
               Set PPTCurrentSlide = PPTPres.Slides.Add(i, ppLayoutBlank)
               With PPTCurrentSlide
                   .FollowMasterBackground = msoFalse
                   .DisplayMasterShapes = msoTrue
                   With .Background
                       .Fill.Visible = msoTrue
                       .Fill.ForeColor.RGB = RGB(255, 255, 255)
                       .Fill.BackColor.SchemeColor = ppAccent1
                       .Fill.Transparency = 0#
                       .Fill.UserPicture ShowFileName(i - 1)
                   End With
'here's where i need something****************************************
               End With
            Next i
               PPTPres.SaveAs filename:="C:\WINDOWS\Desktop\Your PowerPoint
Presentation.pps"
               PPTPres.Close
               Set PPTCurrentSlide = Nothing
               Set PPTPres = Nothing
               Set PPT = Nothing
               MsgBox "Your PowerPoint Slideshow has been created and is on
your desktop!"
End Sub



Sun, 07 Jan 2001 03:00:00 GMT  
 Storing OLE Objects In MSAccess Database
ContainerObject1 is an OLE container bound to an OLE Database field.
I use it off of an Access form. Once I've gotten the name of the file
I have a "save" button perform the following code. You can use other
OLE action settings to "activate in place" or launch the related app
(like Word for .DOC files) standalone where the file menu will say
Close & Return to ... instead of just close. Once Imported or Linked,
OLE handles all the updates for you. Only problem is you have to have
a container object on a form somewhere. It just doesn't work programatically,
which is why MS tells you to mess with those add/getchunk commands.

'import a file as an embedded OLE object
With ContainerObject1
    .SourceDoc = "C:\mydir\myfile.ext"     ' full path & name of file you're embedding.
    .Action = OLE_CREATE_EMBED       ' prep the container to import the file, could be link instead.
    .Action = OLE_ACTIVATE                   ' must activate, otherwise it does nothing.
End With

For graphics, I think you can set an OLE display parameter that says display-data instead
of the default display-as-icon. Its just a matter dealing with focus & getting OLE to behave.

Quote:

>I have a programming problem, that I'm kinda stuck on.

>Application:  Visual Basic Pro 5.0 application driving a MSAccess database
>to store graphic images with a keyword search capability.

>I designed an Access97 database with some OLE object fields in it.  I can
>manually cut and paste objects into it, no problem.  What I'm trying to do
>is (through VBA code) stuff PowerPoint97 Slide objects into the database (I
>can manually insert them with the Insert Object command).

>Below is code I'm using to build a PowerPoint presentation out of bitmaps
>(the database has pointers to the original bitmap files stuck in a
>ShowFileName array).

>Once I create the PPT slide, I want to stuff it into the OLE field in the
>database (so the client can assign keywords to it, etc.).  I've opened a
>recordset object, and done a rsGraphics.AddNew, set the keyfield values, but
>when I try to do a:

>    rsGraphics!([GraphicOLE Field]) = PPTCurrentSlide   'PPTCurrentSlide is
>object in code below

>I get an Object doesn't support something or other error message.  I haven't
>really every had to manipulate OLE objects into and out of my databases, so
>I'm kinda stuck on the syntax of how to stuff objects into OLE fields.

>Anybody know how?

>Private Sub BuildShow()
>    Dim PPT As Object
>    Dim PPTPres As Object
>    Dim PPTCurrentSlide As Object

>    Set PPT = CreateObject("PowerPoint.Application")
>        Set PPTPres = PPT.Presentations.Add(True)
>            For i = 1 To ShowFileName.UBound + 1
>               Set PPTCurrentSlide = PPTPres.Slides.Add(i, ppLayoutBlank)
>               With PPTCurrentSlide
>                   .FollowMasterBackground = msoFalse
>                   .DisplayMasterShapes = msoTrue
>                   With .Background
>                       .Fill.Visible = msoTrue
>                       .Fill.ForeColor.RGB = RGB(255, 255, 255)
>                       .Fill.BackColor.SchemeColor = ppAccent1
>                       .Fill.Transparency = 0#
>                       .Fill.UserPicture ShowFileName(i - 1)
>                   End With
>'here's where i need something****************************************
>               End With
>            Next i
>               PPTPres.SaveAs filename:="C:\WINDOWS\Desktop\Your PowerPoint
>Presentation.pps"
>               PPTPres.Close
>               Set PPTCurrentSlide = Nothing
>               Set PPTPres = Nothing
>               Set PPT = Nothing
>               MsgBox "Your PowerPoint Slideshow has been created and is on
>your desktop!"
>End Sub



Sun, 07 Jan 2001 03:00:00 GMT  
 Storing OLE Objects In MSAccess Database
While that may work, my problem is that I don't have a SourceDoc for my
object (a ppt slide).  In this case the slide object is generated in code,
but in other parts of this application, I'll have to open a PPT Show, and
stuff the individual PPT Slide Objects into the database records.  I tried
something similar to your suggestion, but didn't use the activate command.
Will experiment with that and let the group know.

It seems to me that I shouldn't have to resort to using a control on a form
though.  I've never experimented with GetChunk and AddChunk, so I'll also be
looking into that too.

Quote:

>ContainerObject1 is an OLE container bound to an OLE Database field.
>I use it off of an Access form. Once I've gotten the name of the file
>I have a "save" button perform the following code. You can use other
>OLE action settings to "activate in place" or launch the related app
>(like Word for .DOC files) standalone where the file menu will say
>Close & Return to ... instead of just close. Once Imported or Linked,
>OLE handles all the updates for you. Only problem is you have to have
>a container object on a form somewhere. It just doesn't work
programatically,
>which is why MS tells you to mess with those add/getchunk commands.

>'import a file as an embedded OLE object
>With ContainerObject1
>    .SourceDoc = "C:\mydir\myfile.ext"     ' full path & name of file
you're embedding.
>    .Action = OLE_CREATE_EMBED       ' prep the container to import the

file, could be link instead.
Quote:
>    .Action = OLE_ACTIVATE                   ' must activate, otherwise it
does nothing.
>End With

>For graphics, I think you can set an OLE display parameter that says

display-data instead
Quote:
>of the default display-as-icon. Its just a matter dealing with focus &

getting OLE to behave.

- Show quoted text -

Quote:

>On Wed, 22 Jul 1998 11:31:05 -0700, "Randy Gonzalez"

>>I have a programming problem, that I'm kinda stuck on.

>>Application:  Visual Basic Pro 5.0 application driving a MSAccess database
>>to store graphic images with a keyword search capability.

>>I designed an Access97 database with some OLE object fields in it.  I can
>>manually cut and paste objects into it, no problem.  What I'm trying to do
>>is (through VBA code) stuff PowerPoint97 Slide objects into the database
(I
>>can manually insert them with the Insert Object command).

>>Below is code I'm using to build a PowerPoint presentation out of bitmaps
>>(the database has pointers to the original bitmap files stuck in a
>>ShowFileName array).

>>Once I create the PPT slide, I want to stuff it into the OLE field in the
>>database (so the client can assign keywords to it, etc.).  I've opened a
>>recordset object, and done a rsGraphics.AddNew, set the keyfield values,
but
>>when I try to do a:

>>    rsGraphics!([GraphicOLE Field]) = PPTCurrentSlide   'PPTCurrentSlide
is
>>object in code below

>>I get an Object doesn't support something or other error message.  I
haven't
>>really every had to manipulate OLE objects into and out of my databases,
so
>>I'm kinda stuck on the syntax of how to stuff objects into OLE fields.

>>Anybody know how?

>>Private Sub BuildShow()
>>    Dim PPT As Object
>>    Dim PPTPres As Object
>>    Dim PPTCurrentSlide As Object

>>    Set PPT = CreateObject("PowerPoint.Application")
>>        Set PPTPres = PPT.Presentations.Add(True)
>>            For i = 1 To ShowFileName.UBound + 1
>>               Set PPTCurrentSlide = PPTPres.Slides.Add(i, ppLayoutBlank)
>>               With PPTCurrentSlide
>>                   .FollowMasterBackground = msoFalse
>>                   .DisplayMasterShapes = msoTrue
>>                   With .Background
>>                       .Fill.Visible = msoTrue
>>                       .Fill.ForeColor.RGB = RGB(255, 255, 255)
>>                       .Fill.BackColor.SchemeColor = ppAccent1
>>                       .Fill.Transparency = 0#
>>                       .Fill.UserPicture ShowFileName(i - 1)
>>                   End With
>>'here's where i need something****************************************
>>               End With
>>            Next i
>>               PPTPres.SaveAs filename:="C:\WINDOWS\Desktop\Your
PowerPoint
>>Presentation.pps"
>>               PPTPres.Close
>>               Set PPTCurrentSlide = Nothing
>>               Set PPTPres = Nothing
>>               Set PPT = Nothing
>>               MsgBox "Your PowerPoint Slideshow has been created and is
on
>>your desktop!"
>>End Sub



Mon, 08 Jan 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Store OLE object in database field

2. How to work with MSAccess OLE field to store Word document

3. Storing very large numeric arrays in the database (OLE OBJECT Data Type)

4. Storing Word OLE object in Access database - help!

5. Storing a bitmat in an OLE object field in an Access database

6. References/Samples For Storing OLE Objects In Database

7. Store OLE object in database field

8. How to store BMP files (OLE Object) in Access Database using VB6

9. Storing an OLE object into Access OLE access

10. storing an OLE object into an Access OLE field

11. Importing OLE object from MSAccess to VB Programme

12. OLE OBJECT - > MSACCESS Report

 

 
Powered by phpBB® Forum Software