Cell data to a userform object
Hey everyone!
I'm trying to take the information from a cell which contains a file location and then using that location change the property of an object in one of my userforms. The code I'm showing is the idea of what I want to do but it's not right. UserForm4.Label4.Picture = LoadPicture (Sheets("Sheet1").Cells(counter, 2).value) If someone has a solution that'd be great. Thanks. |
Cell data to a userform object
LoadPicture only works with picture files.
-- Regards, Tom Ogilvy "Syrous" wrote in message ... Hey everyone! I'm trying to take the information from a cell which contains a file location and then using that location change the property of an object in one of my userforms. The code I'm showing is the idea of what I want to do but it's not right. UserForm4.Label4.Picture = LoadPicture (Sheets("Sheet1").Cells(counter, 2).value) If someone has a solution that'd be great. Thanks. |
Cell data to a userform object
That said, if Sheets("Sheet1").Cells(counter,2).Value contained the string
C:\WINNT\Coffee Bean.bmp as an example, it worked fine for me as written Private Sub UserForm_Initialize() counter = 2 UserForm1.Image1.Picture = LoadPicture("C:\Winnt\Coffee Bean.bmp") UserForm1.Label1.Picture = LoadPicture(Sheets(1).Cells(counter, 2).Value) End Sub Note that the image looked better in the image control. -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... LoadPicture only works with picture files. -- Regards, Tom Ogilvy "Syrous" wrote in message ... Hey everyone! I'm trying to take the information from a cell which contains a file location and then using that location change the property of an object in one of my userforms. The code I'm showing is the idea of what I want to do but it's not right. UserForm4.Label4.Picture = LoadPicture (Sheets("Sheet1").Cells(counter, 2).value) If someone has a solution that'd be great. Thanks. |
Cell data to a userform object
Hate to say it, but it works fine for me. What do you have in the variable
counter? What error do you get? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Syrous" wrote in message ... Hey everyone! I'm trying to take the information from a cell which contains a file location and then using that location change the property of an object in one of my userforms. The code I'm showing is the idea of what I want to do but it's not right. UserForm4.Label4.Picture = LoadPicture (Sheets("Sheet1").Cells(counter, 2).value) If someone has a solution that'd be great. Thanks. |
All times are GMT +1. The time now is 07:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com