Visio Guy

Visio Discussions => Programming & Code => Topic started by: thegreatgibsoni on January 08, 2016, 10:07:21 PM

Title: [Solved] Auto ungroup shapes on drop
Post by: thegreatgibsoni on January 08, 2016, 10:07:21 PM
This topic is directly related to a topic from 2008: http://visguy.com/vgforum/index.php?topic=26.msg60#msg60

Basically, I'm using a macro to ungroup a Shape upon drop AND ignore the error message per the instructions in the link above. I also updated how the macro is called (per the thread) to use "CALLTHIS("ThisDocument.UngroupThis")" on the ShapeSheet for the Shape.

However, I drag the shape onto the document but the shape remains grouped. I'm not sure what I'm doing wrong and I need more assistance.

I'm definitely a novice here, and any help will be greatly appreciated. I'm at my wit's end after looking into this issue for 7 hours!
Title: Re: Auto ungroup shapes on drop
Post by: Yacine on January 09, 2016, 10:25:19 AM
Hi,
You need to set up the CallThis routine properly.
- It needs to be in a MODULE of the stencil
- Instead of ThisDocument, try the actual name of the stencil.

Here's a link, where one was struggling with the function: http://visguy.com/vgforum/index.php?topic=4358.0 (http://visguy.com/vgforum/index.php?topic=4358.0)
It actually was discussed plenty of times as you can see:
http://visguy.com/vgforum/index.php?topic=359.0 (http://visguy.com/vgforum/index.php?topic=359.0)
http://visguy.com/vgforum/index.php?topic=4125.0 (http://visguy.com/vgforum/index.php?topic=4125.0)
http://visguy.com/vgforum/index.php?topic=2228.0 (http://visguy.com/vgforum/index.php?topic=2228.0)
Title: Re: Auto ungroup shapes on drop
Post by: thegreatgibsoni on January 11, 2016, 04:33:15 PM
I suppose that's where I'm confused. Again, a complete novice here. I have the module on my stencil and I'm referencing the stencil name in the EventDrop. Why is my shape still grouped on EventDrop?

I've attached a view of what I have done for the Module and ShapeSheet.
Title: Re: Auto ungroup shapes on drop
Post by: Yacine on January 11, 2016, 05:23:48 PM
You would start the debugging process, by checking if the routine is called.
Set a break point at the first instruction step (Application.AlertResponse=1).  https://www.google.de/?gws_rd=ssl#newwindow=1&safe=off&q=vba+set+breakpoint

In one of the links I sent, there are different ways to call the routine. You may try them all. For my part I would have written CALLTHIS("UngroupThis","WireFrameComponents")
Title: Re: Auto ungroup shapes on drop
Post by: thegreatgibsoni on January 11, 2016, 05:36:54 PM
YACINE!!! IT WORKED! THANK YOU!

Changing my EventDrop to "CALLTHIS("UngroupThis","WireFrameComponents")" did the trick!

I was so frustrated with this issue, I was going to give up. Thank you for not giving up on me!!

;D ;D ;D ;D ;D

-jg
Title: Re: Auto ungroup shapes on drop
Post by: Yacine on January 11, 2016, 05:55:11 PM
my pleasure
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 56 (show)
Files included: 25 - 925KB. (show)
Memory used: 772KB.
Tokens: post-login.
Cache hits: 7: 0.00101s for 22,301 bytes (show)
Cache misses: 1: (show)
Queries used: 9.

[Show Queries]