Can't Add Any Controls to an Existing VBA Form

Started by mmulvenna, March 08, 2009, 08:32:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mmulvenna

Hi,

I have a VBA form that I have been using for weeks and it has been working just fine.

If I add any control to a form, even just a label and then try to "show" the form VISIO blows up with a message  "Visio has stopped working". If I remove the control from the form it works just fine.


The Windows error is "an unhandled win 32 exception has occurred"

Anyone have any ideas?

Thanks
Mike

Visio Guy

#1
Can you trap the error in say, the Form.Activate procedure? (I don't think VBA forms have a Load event)

Something like:


Sub FormActivate

OnError Goto ErrActivate

  '...do something...

Exit Sub

ErrActivate:

  Debug.Print Error$

End Sub

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

mmulvenna

I will give it a shot, it happens on any form that I add any control to.

mmulvenna

I need to figure out the addadvise method.   ::) Need to do it for other reasons anyway,

Thanks for the suggestion.

Mike

mmulvenna

#4
Okay, i cant trap the error because VISIO.exe blows up with the following exception reported by the debugger

Unhandled exception at 0x04d73ba5 in VISIO.EXE: 0xC0000005: Access violation reading location 0x00000008.

Anyone have any ideas. DO i need to reload visio? I googled this exception to no avail.

I am having my client try to reproduce on his machine to see if it is perhaps related to a bad install of visio on my machine.

Error was reproduced on client machine, so appaarently it is not a bad VISIO.exe

Thanks
Mike

Paul Herber

Do you want to post the document here (or email it direct to me if you like) - full commercial confidence of course.

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

mmulvenna

#6
Quote from: Paul Herber on March 13, 2009, 03:01:01 PM
Do you want to post the document here (or email it direct to me if you like) - full commercial confidence of course.



Thanks Paul, i will see if my client will allow me to send it to you. (his code)

Some additional info that might help

There are 3 files involved with this error.

cabinet.vsd
  has forms and code to draw visio objects base on form input

commons.vsd
  has code that is common to multiple vsd.s no objects just code. Othere vsd files will also have a reference to this vsd

titleblock.vss
  Stencil for a titleblock


cabinet.vsd has a "Reference" (tools/references)to commons.vsd so that code is automatically included when cabinet.vsd is opened
   the titleblock stencil is open in cabinet.vsd
   If I start the vba editor and add any control to any form in commons, quit the editor and try to execute a common form that    is when  visio blows up.

However, if I start visio and open the commons.vsd make the same changes save it and then reopon cabinet.vsd everyting works fine.

Thanks for taking the time to respond to my 10 months of VISIO experience

The attached file is a screen shot of the VBA editor

Mike




wapperdude

Old guy indeed!   ;D 

I remember when you 1st got going!  You've come along way baby!   ;)
Visio 2019 Pro

mmulvenna

Quote from: wapperdude on March 14, 2009, 12:51:21 AM
Old guy indeed!   ;D 

I remember when you 1st got going!  You've come along way baby!   ;)

Thanks wapperdude, I guess I am going to try a VISIO repair. All I need to do is find the install disks. ::) ::) ::)

mmulvenna

#9
Quote from: mmulvenna on March 14, 2009, 12:56:18 AM
Quote from: wapperdude on March 14, 2009, 12:51:21 AM
Old guy indeed!   ;D 

I remember when you 1st got going!  You've come along way baby!   ;)

Thanks wapperdude, I guess I am going to try a VISIO repair. All I need to do is find the install disks. ::) ::) ::)

Repair did not work. Guess i will try to rebuild the file by copying its parts into a new visio document.

mmulvenna

GOT IT FIXED.  VISIO blew up even before I could get the error trapped. I used the VISUAL STUDIO Debugger and it indicated it was a windows error. Could not find a resolution  Sooooooooo

I took a WAG( wild a.. guess) and  made the commons.vsd a commons.vss and referenced the vss rather than the vsd and it resolved the problem. Go figure ::) ::) ::) ::)