Hello,
I have a vba program. But when i change my optionbutton the picture next to it need to change.
Look ad my attachment:
When in the green box i change the button, the optionbutton needs to change also.
the code i use is:
Private Sub optDSLiBo_Click()
If frmAlgemeen.optDSLiBo = True Then
InsertPicture "C:\Autocad\Afbeeldingen Vba Programma\Hoekverbindingen\LinksBovenStijl.bmp"
End If
End Sub
but i get a error on the this line: "InsertPicture "C:\Autocad\Afbeeldingen Vba Programma\Hoekverbindingen\LinksBovenStijl.bmp""
Does somebody know the answer?
thank you
Solved! Go to Solution.
Solved by Demasure1. Go to Solution.
Hi,
INSERTPICTURE is nothing I know from VBA, if you have a routine (Sub or Function) with that name it's up to you to correct or to show it.
>> but i get a error on the this line:
And the error message is ...?
- alfred -
PS: there is a separate forum for VBA on AutoCAD >>>there<<<.
The error i have is :
" Compile error:
Sub or function not defined"
The code i have added in previous message is all i have.
I have no sub or routine for a image.
How does this work?
Hi,
>> Sub or function not defined
That's the answer, there is no Sub or Function available with name "INSERTPICTURE", so you can't call anything that does not exist.
So where did you find the function-name "INSERTPICTURE" as valid function/sub? Any help file? Or a code in internet? From there you will have to find out what's inside the function/sub.
- alfred -
hi
i found that code on the internet.
i inserted the code into my vba program and changed it to my file.
Met i got the compile error..
I don't need a sub for inserting a image.
I need the image in my userform, When i activate a other button in my userform the picture next to it should change to.
I don't need the image in autocad, only in my userform.
so i tried to do this with a if function
is this the wrong way?
thanks
Try this
If Optionbutton1.Enabled=True then
Myformname.Picture="The Path to picture 1"
ElseIf Optionbutton2.Enabled=True then
Myformname.Picture="The Path to picture 2"
ElseIf Optionbutton3.Enabled=True then
Myformname.Picture="The Path to picture 3"
EndIf
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
hi,
What i the path
is the path: "("C:\Autocad\Afbeeldingen Vba Programma\Hoekverbindingen\LinksBovenRegel.bmp")"?
i get next error:
Object required.
thanks !
Just found what I missed out you need Mypicturebox.Picture = Loadpicture("C:\Autocad\Afbeeldingen Vba Programma\Hoekverbindingen\LinksBovenRegel.bmp")
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
is this what you mean?
I send you a printscreen of my screen with error and help.
Sorry i am still learning vba.
That's alright. Sorry but I have to giggle now as I've seen what your problem is.
You have put in MYPICTUREBOX when in fact it should be the name of your control eg cmdcancel.Picture =LoadPicture etc.
You need to find out what the name of the control where you put the image is called. Looking at your screen shot it might be along the lines of IMAGE1 substitute whatever that control is called for MYPICTUREBOX
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Its solved 🙂
You solved my problem:
If frmAlgemeen.optDRLiBo = True Then
Image12.Picture = LoadPicture("C:\Autocad\Afbeeldingen Vba Programma\Hoekverbindingen\Gif\BovenDoorlopend.gif")
End If
Oh thank you !!!! 😄