Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default moving an image in a userform

hi all!

i have a userform (userform1) and an image on the userform (image1)

i am trying to set the top, left, height and width using the following:

Public Sub setLogo(logo As Image, form As UserForm)

form.logo.Left = 6
form.logo.Top = 6
form.logo.Width = 66
form.logo.Height = 48

End Sub

but i am getting
Run-time error '438'
Object doesn't support this property or method

what am i doing wrong?

oh - and the call is

call setLogo(Image1,UserForm1)

tia

J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default moving an image in a userform

Hi J

If you click "debug" instead of "end" then you might be shown the error. Or
maybe not, if the macros are nested too deep then no luck, it says
"userform1.show" instead.

I can't test it properly without more detail. But two things from reading
it: Width and height may not make sense if you autosize the image. And
"Image1" may or may not make sense, depending on where this code is. Try
call setLogo(UserForm1.Image1,UserForm1)
call setLogo(Me.Image1,UserForm1)

(But why do you need a macro for that operation at all, it seems pretty
fixed ?)

HTH. Best wishes Harald

"Gixxer_J_97" skrev i melding
...
hi all!

i have a userform (userform1) and an image on the userform (image1)

i am trying to set the top, left, height and width using the following:

Public Sub setLogo(logo As Image, form As UserForm)

form.logo.Left = 6
form.logo.Top = 6
form.logo.Width = 66
form.logo.Height = 48

End Sub

but i am getting
Run-time error '438'
Object doesn't support this property or method

what am i doing wrong?

oh - and the call is

call setLogo(Image1,UserForm1)

tia

J



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default moving an image in a userform

In setLogo, remove the second argument "form as Userform" and "form." in
four places preceding logo.

Then simply -
setLogo UserForm1.Image1

or maybe
Dim img As MSForms.Image
Set img = UserForm1.Image1
setLogo img

or
Call setLogo(img)

Regards,
Peter T


"Gixxer_J_97" wrote in message
...
hi all!

i have a userform (userform1) and an image on the userform (image1)

i am trying to set the top, left, height and width using the following:

Public Sub setLogo(logo As Image, form As UserForm)

form.logo.Left = 6
form.logo.Top = 6
form.logo.Width = 66
form.logo.Height = 48

End Sub

but i am getting
Run-time error '438'
Object doesn't support this property or method

what am i doing wrong?

oh - and the call is

call setLogo(Image1,UserForm1)

tia

J



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default moving an image in a userform

Alternatively -

Public Sub setLogo2(form As UserForm, sName As String)

form(sName).Left = 6
form(sName).Top = 6
form(sName).Width = 66
form(sName).Height = 48

End Sub

Regards,
Peter T


"Peter T" wrote in message :
In setLogo, remove the second argument "form as Userform" and "form." in
four places preceding logo.

Then simply -
setLogo UserForm1.Image1

or maybe
Dim img As MSForms.Image
Set img = UserForm1.Image1
setLogo img

or
Call setLogo(img)

Regards,
Peter T


"Gixxer_J_97" wrote in message
...
hi all!

i have a userform (userform1) and an image on the userform (image1)

i am trying to set the top, left, height and width using the following:

Public Sub setLogo(logo As Image, form As UserForm)

form.logo.Left = 6
form.logo.Top = 6
form.logo.Width = 66
form.logo.Height = 48

End Sub

but i am getting
Run-time error '438'
Object doesn't support this property or method

what am i doing wrong?

oh - and the call is

call setLogo(Image1,UserForm1)

tia

J





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default moving an image in a userform

hi Harald - thanks for the response!

- i did hit debug - and the error was
Run-time error '438'
Object doesn't support this property or method


on the line
form.logo.Left = 6


the image is not autosized

the call to setLogo() is in the userform UserForm1 (in UserForm_Initialize)

the code itself is in a module (same project)

and as far as why i need it, i don't really but - it's a pain in the a$$ to
have to set the loc and width of this 40 or 50 times as i'm creating the
userform pages. find it much easier just to plunk it close to where i want
it, create the rest of the stuff and then have it force it into position.
could be wrong - but that's just me =)

in all honesty - all i have is a userform, with an image - and
UserForm_Initialize()
with that call inside.


"Harald Staff" wrote:

Hi J

If you click "debug" instead of "end" then you might be shown the error. Or
maybe not, if the macros are nested too deep then no luck, it says
"userform1.show" instead.

I can't test it properly without more detail. But two things from reading
it: Width and height may not make sense if you autosize the image. And
"Image1" may or may not make sense, depending on where this code is. Try
call setLogo(UserForm1.Image1,UserForm1)
call setLogo(Me.Image1,UserForm1)

(But why do you need a macro for that operation at all, it seems pretty
fixed ?)

HTH. Best wishes Harald

"Gixxer_J_97" skrev i melding
...
hi all!

i have a userform (userform1) and an image on the userform (image1)

i am trying to set the top, left, height and width using the following:

Public Sub setLogo(logo As Image, form As UserForm)

form.logo.Left = 6
form.logo.Top = 6
form.logo.Width = 66
form.logo.Height = 48

End Sub

but i am getting
Run-time error '438'
Object doesn't support this property or method

what am i doing wrong?

oh - and the call is

call setLogo(Image1,UserForm1)

tia

J






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default moving an image in a userform

hmmm

i got it to work by changing

call setLogo(me.image1)

and obviously adjusting the sub to accept only 1 arg
and each line i removed the form. .

thanks guys

J

"Harald Staff" wrote:

Hi J

If you click "debug" instead of "end" then you might be shown the error. Or
maybe not, if the macros are nested too deep then no luck, it says
"userform1.show" instead.

I can't test it properly without more detail. But two things from reading
it: Width and height may not make sense if you autosize the image. And
"Image1" may or may not make sense, depending on where this code is. Try
call setLogo(UserForm1.Image1,UserForm1)
call setLogo(Me.Image1,UserForm1)

(But why do you need a macro for that operation at all, it seems pretty
fixed ?)

HTH. Best wishes Harald

"Gixxer_J_97" skrev i melding
...
hi all!

i have a userform (userform1) and an image on the userform (image1)

i am trying to set the top, left, height and width using the following:

Public Sub setLogo(logo As Image, form As UserForm)

form.logo.Left = 6
form.logo.Top = 6
form.logo.Width = 66
form.logo.Height = 48

End Sub

but i am getting
Run-time error '438'
Object doesn't support this property or method

what am i doing wrong?

oh - and the call is

call setLogo(Image1,UserForm1)

tia

J




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
Check image availability on userform gki Excel Programming 3 July 22nd 04 05:53 PM
UserForm as a Jpeg Image John[_78_] Excel Programming 7 February 19th 04 11:46 AM
Bmp vs Gif in Userform image controls Sandy-V[_2_] Excel Programming 0 January 14th 04 01:46 PM
Userform - dispaly graph as image Robert[_16_] Excel Programming 2 November 14th 03 12:10 PM
Userform Image help Pete[_13_] Excel Programming 1 November 10th 03 10:26 PM


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

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

About Us

"It's about Microsoft Excel"