Upload Pictures in Excel to a database

D

Dave

I am trying to upload a .csv file that I created in Excel
to a online store database.

I have pictures that I would like to associate with the
data (Pricing, Unit Number, etc.)

Does anyone know how I can embed the pictures into an
Excel row?

Thank you!

Dave Bailey
 
D

Dave Peterson

Pictures don't actually go in the cell--they kind of float above the cell in a
different layer.

Can you include the name of the picture in a cell in the same row?

If yes, here's a post that looked at the data in column C and added pictures
based on that value:

One way to do it is to open your .csv file and then run a macro that does the
real work.

It looks like column C will contain the name of the picture.

Option Explicit
Sub testme01()

Dim myPict As Picture
Dim myCell As Range
Dim myRng As Range

With ActiveSheet
Set myRng = .Range("C1", .Cells(.Rows.Count, "C").End(xlUp))
For Each myCell In myRng.Cells
With myCell
If Trim(.Value = "") Then
'do nothing
ElseIf Dir(.Value) = "" Then
.Offset(0, 1).Value = "Not Found"
Else
Set myPict = .Parent.Pictures.Insert(.Value)
With myCell.Offset(0, 1)
myPict.Top = .Top
myPict.Left = .Left
myPict.Width = .Width
myPict.Height = .Height
myPict.Name = "Pict_" & .Address(0, 0)
myPict.Placement = xlMoveAndSize
End With
End If
End With
Next myCell
End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
click on Tools|macro|macros...
click on the macro name (testme01--but you could rename it to something
meaningful!)
and then click run.
 
Top