![]() |
changing image control's picture path
Greetings all,
i am trying to set up a data base that has informaton about inventory items. on the form i have an image control which hopefully will display a picture of the item. the pictures file path will be in the database but i can't seem to get the test code to work. i keep getting a error on the line: Image1.picture = picpath error: compiler error object required. code so far: Private Sub CommandButton1_Click() Dim picpath As String Dim rng As Range Dim Image1 As Control Dim Picture As Property Set myrng = Range("A1") Set picpath = "H:\" & myrng.Value Application.EnableEvents = False Image1.Picture = picpath End Sub thanks in advance to anyone who can show me what i am doing wrong. |
changing image control's picture path
Rather than
Image1.Picture = picpath use Image1.Picture = LoadPicture(picpath) also, if Image1 is the name of the control, remove this line: Dim Image1 As Control Remove this line Dim Picture As Property -- Regards, Tom Ogilvy wrote in message ... Greetings all, i am trying to set up a data base that has informaton about inventory items. on the form i have an image control which hopefully will display a picture of the item. the pictures file path will be in the database but i can't seem to get the test code to work. i keep getting a error on the line: Image1.picture = picpath error: compiler error object required. code so far: Private Sub CommandButton1_Click() Dim picpath As String Dim rng As Range Dim Image1 As Control Dim Picture As Property Set myrng = Range("A1") Set picpath = "H:\" & myrng.Value Application.EnableEvents = False Image1.Picture = picpath End Sub thanks in advance to anyone who can show me what i am doing wrong. |
changing image control's picture path
thank you MISTER Tom Ogilvy
-----Original Message----- Rather than Image1.Picture = picpath use Image1.Picture = LoadPicture(picpath) also, if Image1 is the name of the control, remove this line: Dim Image1 As Control Remove this line Dim Picture As Property -- Regards, Tom Ogilvy wrote in message ... Greetings all, i am trying to set up a data base that has informaton about inventory items. on the form i have an image control which hopefully will display a picture of the item. the pictures file path will be in the database but i can't seem to get the test code to work. i keep getting a error on the line: Image1.picture = picpath error: compiler error object required. code so far: Private Sub CommandButton1_Click() Dim picpath As String Dim rng As Range Dim Image1 As Control Dim Picture As Property Set myrng = Range("A1") Set picpath = "H:\" & myrng.Value Application.EnableEvents = False Image1.Picture = picpath End Sub thanks in advance to anyone who can show me what i am doing wrong. . |
All times are GMT +1. The time now is 07:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com