excel vba - Let Value-string, Get value long VBA -


i'm using class module store values position of buttons. use same function add 3 buttons in row, , need change .left position button based on type;

ie 'create' button, @ .left value column a

for 'update' button, @ .left value column b

for 'destroy' button, @ .left value column c

i add case select in code, readability think sit better in class module.

currently trying following- relevant lines in class module:

private pleft long  public property left() long left = pleft end property  public property let left(strtype string)     select case strtype         case "create"             pleft = prange.offset(0, 4).left         case "update"             pleft = prange.offset(0, 5).left         case "open"             pleft = prange.offset(0, 6).left     end select end property 

relevant lines in module:

dim button cbutton sub letvalueforleft()     set button = new cbutton     button.left = "create" end sub 

heart breakingly error :

enter image description here

i assume because i'm leting string , geting long, there way around this?

i have been using useful guide below, says nothing type of situation:

http://www.cpearson.com/excel/classes.aspx

the let , get of property need same type. if understand correctly you're trying do, can make left read-only property , use method initialize it:

'class private pleft long  public property left() long     left = pleft end property  public sub assignleft(strtype string)     select case strtype         case "create"             pleft = prange.offset(0, 4).left         case "update"             pleft = prange.offset(0, 5).left         case "open"             pleft = prange.offset(0, 6).left     end select end sub 

you'd call this:

set button = new cbutton button.assignleft "create" 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -