Macro -> CTRL+1 = insert shape

M

Maxime Maugeais

Good day,

I would like to know if we can create a macro that would insert a
rectangular shape with X width,Y height and have an associate shortcut.

So if the user hits CTRL+1, this would insert a rectangular shape with a
predetermined width. By doing CTRL+2, a different predetermined rectangular
shape would be inserted.

Ih this is possible, what would the code look like.
 
D

David Parker

If you are using Visio 2003, then you can record a macro and you would get
something like this:

Sub AddRectangle()
' Keyboard Shortcut: Ctrl+Shift+R
'

Application.ActiveWindow.Page.DrawRectangle 1.181102, 9.448819,
2.362205, 8.661417

End Sub

You cannot use a number as the shortcut key
see the Help file
objRet = object.DrawRectangle (x1, y1, x2, y2)
 
M

Mark Nelson [MS]

Ctrl+1 and other numbers are the shortcut keys for each of the drawing
tools.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top