View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wisaac wisaac is offline
external usenet poster
 
Posts: 3
Default Copying images from Excel to Access

(wisaac) wrote in message om...
I would like to automate the process of copying an image from Excel to
the clipboard, and pasting it into an OLE Object field in an Access
table.

I want to do something like:

Dim MySheet As Worksheet
Set MySheet = appX.Workbooks(Filename).Worksheets("Requirements" )
Dim pic As Shape
rsExcelImport.MoveFirst
For Each pic In MySheet.Shapes
pic.Copy
'Somehow paste to MS Access
rsExcelImport.MoveNext
Next pic

Any advice on how I can accomplish this?


It looks like the right way to do this is with a form.

Set frm = Forms!frmExcelImport
i = 1
For Each pic In MySheet.Shapes
pic.Copy
frm.GoToPage i
frm.Requirement.OLETypeAllowed = acOLEEmbedded
frm.Requirement.Class = ""
frm.Requirement.Action = acOLECreateEmbed
frm.Requirement.Action = acOLEPaste
i = i + 1
Next pic

I am hoping to get this code working, but I don't know what class to
use. I get an error stating "The item on the Clipboard can't be
pasted into this control." It is a bitmap that is being copied to the
clipboard. Anyone know what class to use?