Recent Posts

Pages: [1] 2 3 ... 10
1
Attached is what is desired using some test data.

This was actually created in 2014 using Smart Shapes based on the Trilogy post on this site. Looking to redo this using with more shapes and up to date code as it was so successful.
2
As I think about this, if you need to name each dropped shape, drop many may be wrong method.


My first reaction was to write "why use shape names at all? Use custom properties". But that is not really right. Using shape names help accessing them directly instead of iterating over all shapes. Thus much faster code.


But it is legimate to rename the shapes once, following arbitrary rules - eg: this_and_that_number_ID_Time_or_whatever. The naming could even be performed on the base of prop fields and especially based on the x,y coordinates, that are known from the DropMany arguments.
The arrays would ideally be built from a table (Excel) holding not only the coordinate, but also an ID.

So you'll have once a somewhat longer execution time, but only once - at creation time. Afterwards, you're again at it with accessing the shapes by their name.


"Name", not "NameU".
3
How do you want the end result to look, if you make a mock up then we can understand what you want to achieve!
4
ChatGPT obviously never developers for Visio because the Visguy forum is the one that rules them all!
5
The maser shape is a smart shape which represents a standard process and each of the duplicated shapes would represent another process.

The idea is to map an entire process suite which consists of many processes duplicated from the standard process.  So each of duplicates would have their own name and be on the same page. then they would position themselves and resize themselves based on the data.

The page links are done via the shape name thus the need to rename the duplicates.
6
Programming & Code / Re: Using ChatGPT to write VBA code for Visio app
« Last post by Surrogate on Today at 01:32:16 AM »
it is a genius!
New experiments:

Surrogate: /ask most visited visio forum in the world

ChatGPT: It's difficult to determine the most popular Visio forum in the world, as there are many forums and online communities dedicated to Visio, and their popularity may depend on factors such as language, region, and user base. However, some of the most popular and active Visio forums include:

1. Microsoft Tech Community - Visio: A community forum for Visio users hosted by Microsoft.
2. Visio Guy: A forum for Visio users featuring tips, tutorials, and discussion on a range of topics.
3. Stack Overflow: A popular question-and-answer site for programming and software development, including Visio-related topics.
4. Reddit: The r/Visio subreddit is an active community for Visio users to share tips, ask questions, and discuss Visio-related topics.

These are just a few examples; there are many other Visio forums and communities online that you can explore.
I was especially amused that Microsoft Tech Community was at the top of the list!
7
ShapeSheet & Smart Shapes / Re: Dupicate a master shape as multiple smart shapes
« Last post by wapperdude on March 27, 2023, 05:34:27 PM »
As I think about this, if you need to name each dropped shape, drop many may be wrong method.  The core name of each placement is the reference.  Each subsequent shape has an incremented ID.  The arrays store only Base namre, location, and ID.   So It would then be necessary to iterate all of the placed shapes to rename them.

You could write custom code to enable custom naming.  Generally, it's not a preferred method to use custom shape names.  There are some issues.  Rather, the more common practice is to put a reference designation identifier into shapesheet.
8
ShapeSheet & Smart Shapes / Re: Dupicate a master shape as multiple smart shapes
« Last post by wapperdude on March 27, 2023, 02:10:07 PM »
I re-worked the drop many code to work with a single master/shape.  The shape, in this code, is selected from the Document stencil.  Only the active page is targeted, but a For / Next loop could be used to do all pages and/or add pages.  Both the shape and number of placements are hard coded. 

HTH
Code
Sub Relicate()
'This macro duplicates a single master / shape on the active page for the desired number of times.number of times.
'Both the shape name and number of shapes are hard coded in this code example.
'At the end, in the immediate window, a summary is debug printed
'Code was re-worked from DropMany code example.
'Wapperdude

    Dim mShp As Visio.Master
    Dim iCnt As Integer
    Dim numShps As Integer
    Dim aintIDArray() As Integer
    Dim intProcessed As Integer
     
    iCnt = 1
    numShps = 5     'Enter number of shapes per page
           
    Set mShp = Documents.Item("Drawing1").Masters.ItemU("Square")
'    Debug.Print mShp.Name
     
    ReDim varObjectsToInstance(1 To numShps) As Variant
    ReDim adblXYArray(1 To numShps * 2) As Double
   
    For iCnt = 1 To numShps
'   Pass name of object to drop to DropMany.
        varObjectsToInstance(iCnt) = mShp.Name
     
'   Set x components of where to drop to 2,4,6,2,4,6,2,4,6,...
        adblXYArray(iCnt * 2 - 1) = (((iCnt - 1) Mod 3) + 1) * 2
     
'   Set y components to 2,2,2,4,4,4,6,6,6,...
        adblXYArray(iCnt * 2) = Int((iCnt + 2) / 3) * 2
    Next iCnt
     
    intProcessed = ThisDocument.Pages(1).DropMany(varObjectsToInstance, adblXYArray, aintIDArray)

    Debug.Print "Number of shapes Processed:  " & intProcessed
    Debug.Print "Shp" & Chr(9) & "ID"
     
    For iCnt = LBound(aintIDArray) To UBound(aintIDArray)
        Debug.Print iCnt & Chr(9) & aintIDArray(iCnt)
    Next iCnt
 
End Sub
9
How do you want the end result to look?
10
ShapeSheet & Smart Shapes / Re: Dupicate a master shape as multiple smart shapes
« Last post by visio on March 27, 2023, 10:20:51 AM »
tried using the example in this link https://learn.microsoft.com/en-us/office/vba/api/visio.page.dropmany which duplicates all master templates onto a page with the duplicate shapes having the same name, this is close but not quite there.

Wanting to duplicate a single master as multiple shapes but each with different names and use a driver file or list to speed things up.

Any help appreciated 
Pages: [1] 2 3 ... 10