Newbie Code Question: Showing various pictures on a form

D

DDawson

I have a spreadsheet which contains a Combobox with an Index function to
display information from the selected record of another worksheet.

I have created a Form with a picture object and have added the following
code to the form:

Private Sub UserForm_Initialize()
Dim PicPath As String ' Declare Picpath

' The path and filename of the selected record's picture is contained within
cell F9
PicPath = ("F9")
frmLabel.Picture = LoadPicture("PicPath")

End Sub

Surprisingly it doesn't work.
Can someone help me with this and tell me what I have missed please?

Dylan Dawson
Scotland
 
J

John Bundy

Private Sub UserForm_Initialize()
Dim PicPath As String ' Declare Picpath

' The path and filename of the selected record's picture is contained within
cell F9
PicPath = cells(9,6)
frmLabel.Picture = LoadPicture(PicPath)

End Sub

-john
 
D

dd

Hi John,

Thanks for the info - I added it as a Worksheet Calculate Function to an
Image object as follows, can you help me with error handling, I get the
following error "Runtim-error '53': File not found:

Private Sub Worksheet_Calculate()
Dim PicPath As String ' Declare Picpath

' The path and filename of the selected record's picture is contained
within cell F9
PicPath = Cells(9, 6)
Image1.Picture = LoadPicture(PicPath)

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top