Visio Guy

Visio Discussions => Visio 2013 Issues => Topic started by: oceangoing on August 16, 2016, 12:10:08 AM

Title: Compile Error: User not not defined. Macro is not working in Visio 2013
Post by: oceangoing on August 16, 2016, 12:10:08 AM
Hi All,
Much appreciated if you can help me to solve this problem.

I have some macros working Visio 2010 are fine. Recently, we decide to move our Visio 2010 to Visio 2013. I have tried many methods to clean up but still have the following macros can not be recoganized.
For example, the following macro is still showing me "Compile Error: User-defined type is not defined". I have tried all possible libry like, DAO 3.6, ActiveX Data 6.1 object library and so on.
Function vbCompExists(objVBProject As VBIDE.VBProject, strCompName As Variant)
    vbCompExists = 0
    For x = 1 To objVBProject.VBComponents.count
        If objVBProject.VBComponents.Item(x).name = strCompName Then
            vbCompExists = x
            Exit Function
        End If
    Next
End Function
The Visio 2013 is still not working with Macros.

Please help!!!
Title: Re: Compile Error: User not not defined. Macro is not working in Visio 2013
Post by: zhuravsky on August 16, 2016, 04:57:36 AM
Did you try this?
https://social.msdn.microsoft.com/Forums/office/en-US/1f8d4fc9-d5a5-433d-bf07-92ca493f01d4/programmatically-adding-references-vbide-is-not-recognized?forum=exceldev
Title: Re: Compile Error: User not not defined. Macro is not working in Visio 2013
Post by: AndyW on August 16, 2016, 06:58:00 AM
You just need to add the reference

'Microsoft Visual Basic for Applications Extensibility 5.3'