Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copying images from Excel to Access

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Copying images from Excel to Access

Hi,

i'm working on

Sub PowerPointOLEAutomation()
Dim objPPT As Object
Dim Pres As PowerPoint.Presentation
Dim i As Integer
Dim Dave As String

filepath = Sheets("progdata").Cells(133, 2).Value

'creates the PowerPoint Object
Set objPPT = CreateObject("powerpoint.application")
objPPT.Visible = True 'Makes PowerPoint visible


'Adds a blank presentation
Set Pres = objPPT.Presentations.Open( _
FileName:=filepath, ReadOnly:=msoFalse)



'adds a blank slide and paste the chart
i = 0
x = 2
Slide = "Slide2"
picturename = "Picture 1"
For i = 0 To 24

Set Slide = Pres.Slides.Add(x, ppLayoutBlank)
Dave = i
Call UpdateChart(Dave)
objPPT.ActivePresentation.Slides(x).Shapes.Paste

' objPPT.ActivePresentation.Selection.SlideRange.Sha pes(picturename).Select
' With ActiveWindow.Selection.ShapeRange
' .Left = -5.12
' .Top = 10.25
' End With

picturename = "Picture " & i + 1
Slide = "Slide" & x
x = x + 1
Next

to move Pictures to power point, it's not what your after, but shows
how to work with another app.

Might be some help?

Good LUck
Ross
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Copying images from Excel to Access

(ross) wrote in message . com...

Dim i As Integer
Dim Dave As String
Dave = i


It's a brave person who posts their in-production code.

--
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copying images from Excel to Access

(ross) wrote in message . com...
Hi,

i'm working on

Sub PowerPointOLEAutomation()
Dim objPPT As Object
Dim Pres As PowerPoint.Presentation
Dim i As Integer
Dim Dave As String

filepath = Sheets("progdata").Cells(133, 2).Value

'creates the PowerPoint Object
Set objPPT = CreateObject("powerpoint.application")
objPPT.Visible = True 'Makes PowerPoint visible


'Adds a blank presentation
Set Pres = objPPT.Presentations.Open( _
FileName:=filepath, ReadOnly:=msoFalse)



'adds a blank slide and paste the chart
i = 0
x = 2
Slide = "Slide2"
picturename = "Picture 1"
For i = 0 To 24

Set Slide = Pres.Slides.Add(x, ppLayoutBlank)
Dave = i
Call UpdateChart(Dave)
objPPT.ActivePresentation.Slides(x).Shapes.Paste

' objPPT.ActivePresentation.Selection.SlideRange.Sha pes(picturename).Select
' With ActiveWindow.Selection.ShapeRange
' .Left = -5.12
' .Top = 10.25
' End With

picturename = "Picture " & i + 1
Slide = "Slide" & x
x = x + 1
Next

to move Pictures to power point, it's not what your after, but shows
how to work with another app.

Might be some help?

Good LUck
Ross



Thanks for the advice, but unfortunately, I don't think that Access
works like PowerPoint.

Here's my code:

Private Sub ImportSpreadsheet()
Dim PathToExe As String
Dim Filename As String
Dim retVal As Variant

On Error GoTo error

OpenExcelFile PathToExe, Filename

If PathToExe = "" Then
Exit Sub
End If

DoCmd.TransferSpreadsheet _
TransferType:=acImport, _
SpreadsheetType:=acSpreadsheetTypeExcel97, _
TableName:="tblExcelImport", _
Filename:=PathToExe, _
HasFieldNames:=True

Dim appX As Excel.Application
Set appX = GetObject(, "Excel.Application.8")
ERROR429:
If Err.Number = 429 Then
Set appX = CreateObject("Excel.Application.8")
End If
appX.Workbooks.Open Filename:=PathToExe, ReadOnly:=True

Dim db As Database
Dim rsExcelImport As recordSet

Set db = CurrentDb()
Set rsExcelImport = db.OpenRecordset("tblExcelImport",
dbOpenDynaset)

Dim MySheet As Worksheet
Dim row
Set MySheet = appX.Workbooks(Filename).Worksheets("Requirements" )
row = 1

Dim pic As Shape
rsExcelImport.MoveFirst
Dim i As Integer
i = MySheet.Shapes.count
For Each pic In MySheet.Shapes
With rsExcelImport
.Edit
![Requirement] = pic
.Update
End With
rsExcelImport.MoveNext
Next pic

appX.Quit

Exit Sub

error:
If Err.Number = 429 Then
GoTo ERROR429
End If
Debug.Print "Error #" & Err.Number & ": " & Err.Description
Exit Sub
End Sub

This code does NOT work. I cannot assign pic to ![Requirement] (an
OLE Object field). Is there a way to make the assignment? I want to
copy the pic object to the OLE Field.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I customise quick access toolbar button images in Excel 200 Andie Excel Discussion (Misc queries) 1 August 25th 07 12:08 PM
Copying Data from Access to Excel in a macro GLS Excel Worksheet Functions 2 November 15th 06 03:47 PM
Copying figures from Access to Excel dalymjl Excel Worksheet Functions 0 September 29th 06 05:49 PM
how i convert excel files with images to access mike Excel Discussion (Misc queries) 1 March 7th 05 05:51 PM
how i convert excel files with images to access mike Excel Discussion (Misc queries) 1 March 7th 05 03:11 AM


All times are GMT +1. The time now is 08:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"