Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Class Declarations not working in visio

Status
Not open for further replies.

Kalisto

Programmer
Feb 18, 2003
997
GB
OK, I inserted a new class module into my visio project, and called it objClass
In the file I have
Code:
option explicit

private name as string

private sub class_initialize()
End sub

public sub SetData(T as shape)
name = T.name
end sub

1) Why does the class_initialize appear (from the drop down menus at the top of the editing window) as a class function, but the SetData one doesn't ?

2) Despite 1, if I use the code below, the SetData function appears in teh quick select list, but I get a runtime error 424, what am I doing wrong ?

Code:
Dim test as objClass
Dim mShape as Shape
Set mShape = myPage.Shapes(5) 'Via Debug this line works
Test.SetData(mShape) 'This line causes runtime error

I am going mad here, so anyone with any hints I'd appreciate it !

K
 
Hi Kalisto,

I'm not hot on classes but you do not appear to have instantiated your object. Try it with ..

Code:
Dim test as
Code:
New
Code:
 objClass

Enjoy,
Tony
 
Thanks Tony, that didn't make any difference. If I add a new method to my class that takes a string then that method works, so it looks like it is the Shape object from visio it is having problems with, so It's over to the Visio forum I think !

K
 
Hi Kalisto,

Is it a simple syntax error? I'm not familiar with VBA in Visio but try getting rid of the parentheses ..

Code:
Test.SetData(mShape)
is passing a string (when a shape is expected), and ..

Code:
Test.SetData mShape
is passing a shape.

Enjoy,
Tony

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top