ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Newbie Code Question: Showing various pictures on a form (https://www.excelbanter.com/excel-programming/378682-newbie-code-question-showing-various-pictures-form.html)

DDawson

Newbie Code Question: Showing various pictures on a form
 
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



John Bundy

Newbie Code Question: Showing various pictures on a 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 = cells(9,6)
frmLabel.Picture = LoadPicture(PicPath)

End Sub

-john


"DDawson" wrote:

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



dd

Newbie Code Question: Showing various pictures on a form
 
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



dd

Newbie Code Question: Showing various pictures on a form
 
Problem Solved !





All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com