I am trying to import a picture into an excel 2000 spreadsheet based on the value in cell A1. The folling code gives me a #VALUE! error. Cell B12 has
=MYPIC() in it. Any suggestions?
Function MYPIC() As Object
Dim myXl As Object
Dim PATH As String
Dim FILE As String
Set FILE = CELL.Range("A1".Value
PATH = "X:\PICTURES" & FILE & ".JPG"
Set myXl = GetObject(, "Excel.Application"
Set MYPIC = myXl.Sheets(1).Pictures.Insert(PATH)
MYPIC.Top = myXl.Range("B12".Top
MYPIC.Left = myXl.Range("B12".Left
MYPIC.ShapeRange.Height = myXl.Range("B12".RowHeight * 12
End Function
willybgw
=MYPIC() in it. Any suggestions?
Function MYPIC() As Object
Dim myXl As Object
Dim PATH As String
Dim FILE As String
Set FILE = CELL.Range("A1".Value
PATH = "X:\PICTURES" & FILE & ".JPG"
Set myXl = GetObject(, "Excel.Application"
Set MYPIC = myXl.Sheets(1).Pictures.Insert(PATH)
MYPIC.Top = myXl.Range("B12".Top
MYPIC.Left = myXl.Range("B12".Left
MYPIC.ShapeRange.Height = myXl.Range("B12".RowHeight * 12
End Function
willybgw