Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charts to Image or Picture? Bill Elerding Charts and Charting in Excel 2 May 5th 05 12:54 PM
How do copy text from a picture/image & make it available for edi. copy text from image to excel Excel Discussion (Misc queries) 2 March 18th 05 04:35 PM
reference an ole image control's .Picture filename? bdcrisp[_22_] Excel Programming 3 January 3rd 04 04:41 PM
userform image from picture in worksheet Doug Glancy[_5_] Excel Programming 2 November 10th 03 04:43 AM
VBA : A picture from http://.../Image.gif VUILLERMET Jacques Excel Programming 2 October 1st 03 09:24 PM


All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"