Keyboard shortcut for RIGHT ARROW END!

Started by tinsley207, April 21, 2015, 03:36:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tinsley207

Hello All!  New to the forum!  And relatively new to VISIO!  I'm using Visio 2013 and I'm a huge keyboard user.  I like to have keystrokes or even macros for as many things as possible.  I do a lot of signal flow path drawings and I am ALWAYS adding a "Arrow at END" on my connector lines.  I'm really tired of selecting the ARROWS tool then navigating down to the "Arrow at end" and clicking.  It just takes too long. I want to be able to draw the connector using the connector tool and then hit F2 and BANG have visio drop the arrow at the end of the line!  Can I do this?  I will mention that I've already done some macro work with my Microsoft Keyboard but what I really would need is the actual menu items etc to do what I want and I just can't seem to find that.  Please help!

Nate


Yacine

Hi Nate,
no need for a macro.
Set up a template fromwhich you will start every time.
Draw a connector, set its line ends to whatever you want, drag it in the page stencil. save, close, done.
Next time you create a new drawing from the template, all your connectors will have the settings, you prepared in the template.
Yacine

tinsley207

That's nice but not all my connectors have arrows.  Also what is the PAGE STENCIL?  Is that the shape stencil column typically on the left?
Thanks
Nate

Yacine

#3
Hi Nate,
The small link beneath the actual message is an attachment. LeftMouseClick on Link and Download. Goto Downloads and test. ;D
... and I gave you that advice, because you explicitely wrote "ALWAYS adding ...".
So I understand that this is an "almost" ALWAYS.  ;)
In this case , you'll stay with the template, but need to add an according macro to it.
Record a macro in which you'll format properly the connector, assign it to the keyboard shortcut of your choice and save as template.
Yacine

tinsley207

Hi Yacine,

Well your cool drawing works but of course it's for EVERY connector!  Yes I guess I should have been more specific!  It's not EVERY connector but ALMOST.  So I started in on the other idea with the macro.  I've never recorded a macro before but I made a template called 11x17default.vst.  I made a simple connector line, then I recorded a new macro using CTRL+Q for the shortcut, and clicked the arrow at end button and chose my style.  Then I stopped the macro.  I saved the document and it wanted to be a VSTM so I did that.  Now when I open the template I get a warning about macros, so I said ENABLE Macros.  I drew a line and pressed CTRL+Q..... nothing.  I closed visio and reopened, then opened the template.  This time I went into macro security and enabled all macros(not recommended) but still nothing when I press CTRL+Q.  What am I missing here?  Thanks.

Nate

Surrogate

Hi, Nate!
You first time tried record macro via recorder, and after enable macros abilities?
Press keys Alt+F11,  can you see some code in Module1?

I am haven't there PC with  visio, but i think you MUST enable macros BEFORE
you start play with macrorecorder. On my PC macro ALWAYS enable!


Yacine

With Ctrl-F11 you can open the Visual Basic Editor (VBE).
Can you post the code displayed in the recorded macro?
You could also upload the visio template, but please as Visio 2007 version, as I cannot open versions above.
Yacine

Surrogate

Quote from: Yacine on April 22, 2015, 04:53:22 AM
With Ctrl-F11 you can open the Visual Basic Editor (VBE).
Yacine, but with Ctrl+F11 you open window for change texts tabs :)

Nate, check your macro options
Press Alt+F8


Surrogate

#8
oh, i see !!!
when you user macrorecorder it write line like is
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject, visRowLine, visLineEndArrow).FormulaU = "4"
this code can change only shape with ID = 1.
Quote from: tinsley207 on April 21, 2015, 09:56:03 PM
I drew a line and pressed CTRL+Q..... nothing. 
your new drawed line can't have ID = 1.
you must modify your macro, for example
Sub Macro1()
' Keyboard Shortcut: Ctrl+q
'
Dim sh As Shape
Set sh = ActiveWindow.Selection(1)
sh.CellsSRC(visSectionObject, visRowLine, visLineEndArrow).FormulaU = "4"
End Sub

Quote from: wapperdude on April 15, 2015, 05:27:04 PM
  Bring up the macros window (Alt+F8) or Tools>macros.  Select (high light) the macro from the list and then press Options...  Enter the desired key in the box.  That's it.

Yacine

Quote from: Surrogate on April 22, 2015, 09:08:15 AM
Yacine, but with Ctrl+F11 you open window for change texts tabs :)

Right I meant the other CTRL: "ALT" ;)
Yacine

tinsley207

I double checked my macro options and I do have "q" in the appropriate box.  Here is my macro


Sub Arrow()
'
' Adds ARROW at END to the end of a line.
'
' Keyboard Shortcut: Ctrl+q
'

    'Enable diagram services
    Dim DiagramServices As Integer
    DiagramServices = ActiveDocument.DiagramServicesEnabled
    ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150

    Dim UndoScopeID1 As Long
    UndoScopeID1 = Application.BeginUndoScope("Line Ends")
    Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject, visRowLine, visLineEndArrow).FormulaU = "13"
    Application.EndUndoScope UndoScopeID1, True

    'Restore diagram services
    ActiveDocument.DiagramServicesEnabled = DiagramServices

End Sub

Surrogate

Hi, Nate ! did you see this message ?
Quote from: Surrogate on April 22, 2015, 09:25:53 AM
oh, i see !!!
when you user macrorecorder it write line like is
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject, visRowLine, visLineEndArrow).FormulaU = "4"
i am guess  ;)
Quote from: tinsley207 on April 22, 2015, 08:05:52 PM
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject, visRowLine, visLineEndArrow).FormulaU = "13"

tinsley207

OK Surrogate you're going to have to be more clear.  What should my macro say?

wapperdude

Surrogate did, see reply #8, i.e., use selection(1) syntax.  This refers to the 1st (only) selected item, not to a specific shape.

Wapperdude
Visio 2019 Pro

tinsley207

Wapperdude I am BRAND NEW to macros.  Can you please show me in my macro where the edit needs to take place?  I've looked at the code in reply 8 and I'm sorry but I just don't see where the code needs to change!! Help!