ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   store SHAPE-Object on disk (https://www.excelbanter.com/excel-programming/343762-store-shape-object-disk.html)

Heiko Schmidtke

store SHAPE-Object on disk
 
Hello,

I have an Excel sheet with one or more shape objects (pictures).
I need to programm a little VBA-routine to extract these pictures form the
sheet and store them on disk.

I already know how to extract the SHAPES:

Dim varPicture As Shape
For Each varPicture In ActiveSheet.Shapes
varPicture.Select
Next varPicture

I even know how to store them in the clipboard-device:
varPicture.CopyPicture

But how can I store them on disk. What doesn't work (but explains my problem
well): varPicture.savetofile "c:\myPic.bmp"

Who knows better?

Heiko



Tom Ogilvy

store SHAPE-Object on disk
 
I haven't tried it, but save a copy of your worksheet as html and I believe
the shapes will be saved as separate GIF files.

--
Regards,
Tom Ogilvy

"Heiko Schmidtke" wrote in message
...
Hello,

I have an Excel sheet with one or more shape objects (pictures).
I need to programm a little VBA-routine to extract these pictures form the
sheet and store them on disk.

I already know how to extract the SHAPES:

Dim varPicture As Shape
For Each varPicture In ActiveSheet.Shapes
varPicture.Select
Next varPicture

I even know how to store them in the clipboard-device:
varPicture.CopyPicture

But how can I store them on disk. What doesn't work (but explains my

problem
well): varPicture.savetofile "c:\myPic.bmp"

Who knows better?

Heiko





Heiko Schmidtke

store SHAPE-Object on disk
 
Well, think that works.
At least I was able to transfert the pics on disk, I could open them and I
stored them on SQL-Server:

Dim rst As New ADODB.Recordset
Dim con As New ADODB.Connection
Dim stm As New ADODB.Stream

ActiveWorkbook.PublishObjects.Add("Page.htm", "Sheet", "", xlHtmlStatic,
"Testname", "Testname").Publish (True) 'Store as HTML files + jpg-pics

Set con = CurrentProject.Connection
stm.Type = adTypeBinary
stm.Open
stm.LoadFromFile Pfad + "HTMLpage_image003.jpg"

rst.Open "tbl_Pr_Ld", con, adOpenDynamic, adLockOptimistic
rst.AddNew
rst![Pr_Ld_Pic] = stm.Read
rst.Update

That works fine. But now I can no longer watch the pics in my Access-form.
Do they have a wrong format. When transferred manually by Clipboard one can
see the pics. Access simply doesn't show the pics!

Regards,
Heiko



"Tom Ogilvy" schrieb im Newsbeitrag
...
I haven't tried it, but save a copy of your worksheet as html and I

believe
the shapes will be saved as separate GIF files.

--
Regards,
Tom Ogilvy

"Heiko Schmidtke" wrote in message
...
Hello,

I have an Excel sheet with one or more shape objects (pictures).
I need to programm a little VBA-routine to extract these pictures form

the
sheet and store them on disk.

I already know how to extract the SHAPES:

Dim varPicture As Shape
For Each varPicture In ActiveSheet.Shapes
varPicture.Select
Next varPicture

I even know how to store them in the clipboard-device:
varPicture.CopyPicture

But how can I store them on disk. What doesn't work (but explains my

problem
well): varPicture.savetofile "c:\myPic.bmp"

Who knows better?

Heiko









All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com