HI All
I have been trying to write a script to count symbols within a document. Has anyone done this as I cannot make it work. Just need it to copy the name and value (number of items) to the clip board so I can use it from there.
I found an old thread that counted shapes and this worked well, however need to have it count symbols instead, but would not work when I modified it.
Any help would be greatly appreciated and thank you in advance for any assistance.
Thanks
Grant
???
Sub SymbolCount()Dim s As Shape, sr As ShapeRangeSet sr = ActiveSelectionRangeFor Each s In srIf Not s.Type = cdrSymbolShape Thens.RemoveFromSelectionEnd IfNext sMsgBox ActiveSelection.Shapes.Count & " Symbols Selected"End Sub
HI, sorry finally got back on to this project. How do I load this Script in to Corel 2018. Have tried multiple ways but wont load.
This is not script, this is VBA-code for macro. Open Macro Manager and create new project. Type name of any gms-file, open VBA-editor and copy/paste code of subroutine
Thanks. Have done this and tried to run. It flashes the screen a few times and then gives an answer of 1 symbol counted. But cant find where it gives the actual results of each symbol and the count of each.
try this code:
Sub CountSymbols()Dim sd As SymbolDefinition, ts& ts = 0 For Each sd In ActiveDocument.SymbolLibrary.Symbols ts = ts + sd.Instances.Count Next MsgBox "Total symbols on all pages: " & tsEnd Sub
Cheers, getting slightly closer. We use this for electrical plans and need it to count a range of symbols and give us a result that stats Symbol 1 = 20, symbol 2 = 9, and so on. Where "symbol 1" may be named double plugs, we need this copied to a clipboard so we can dump in to an excel.
Sub CountSymbols()Dim sd As SymbolDefinition, ts&, Stat$ ts = 0 For Each sd In ActiveDocument.SymbolLibrary.Symbols ts = ts + sd.Instances.Count
Stat = Stat & sr.Name & " - " & sd.Instances.Count & vbCr Next MsgBox Stat & vbcr & "Total symbols on all pages: " & tsEnd Sub