Hi,
If I draw a rectangle this is assigned an incremental id, e.g.
Application.ActiveWindow.Page.DrawRectangle 3, 10.2, 4.3, 9.5 'will be assigned shape id 1
Application.ActiveWindow.Page.DrawRectangle 1, 9.2, 2.3, 8.5 'will be assigned shape id 2
Application.ActiveWindow.Page.DrawRectangle 3, 9.2, 4.3, 8.5 'will be assigned shape id 3
Is there any way I can draw a rectangle and assign a name to it when I draw it without having to select it first?
Thanks :-)
dim shp as shape
shp = Application.ActiveWindow.Page.DrawRectangle 3, 9.2, 4.3, 8.5
shp.Name = "fred"
Thanks
Visio didn't like
shp = Application.ActiveWindow.Page.DrawRectangle 3, 9.2, 4.3, 8.5
(font changed to red and error: expected end of statement)
:-)
Ah yes, sorry, I don't normally do VBA,
Set shp = Application.ActiveWindow.Page.DrawRectangle 3, 9.2, 4.3, 8.5
Thanks
For some reasons VBA needs brackets when using Set
Set shp = Application.ActiveWindow.Page.DrawRectangle(1, 9.2, 2.3, 8.5)
:-)
Yes, that's the correct syntax: https://msdn.microsoft.com/en-us/library/ms196001(v=office.12).aspx
Wapperdude