Hi. Can someone check this code and let me know if this is possible?
1 2 3 4 5 6 7 8 9 10 11 12 13
Dim OrigSelection As ShapeRange Set OrigSelection = ActiveSelectionRange ActiveDocument.BeginCommandGroup OrigSelection(2).Style.StringAssign "{""dimension"":{""overhang"":""0"",""centerText"":""1"",""horizontalText"":""0"",""boxAroundText"":""0"",""textStyle"":""1"",""textPlacement"":""0"",""precision"":""4"",""units"":""0"",""useDefaultAnchorGap"":""1"",""angularUnits"":""1"",""showUnits"":""1"",""showLeadingZero"":""0"",""useDefaultOverhang"":""1"",""dynamicText"":""1"",""reverseTerminators"":""0"",""anchorGap"":""0"",""hideGapOnFreeExtension"":""1"",""radialTextAboveLine"":""0"",""labelGap"":""0"",""suffix"":"""",""useDefaultReverseTerminatedLength"":""1"",""radialInsideOutside"":""0"",""radialSymbol"":""4"",""hideCDWhenReverseTerminated"":""0"",""showInnerExtensionLines"":""1"",""prefix"":"""",""useDefaultLabelGap"":""1"",""showExtLines"":""1"",""dimetricSymbol"":""6"",""reverseTerminatedLength"":""0"",""autoReverseTerminator" & _ "s"":""1"",""includeCDReverseTerminated"":""0""},""character"":{""latin"":{""script"":""0"",""charset"":""0"",""weight"":""64"",""font"":""Verdana"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""v_shift"":""0"",""RTL"":{""script"":""0"",""charset"":""178"",""weight"":""64"",""font"":""Arial"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""h_shift"":""0"",""farEast"":{""script"":""0"",""charset"":""129"",""weight"":""64"",""font"":""Malgun Gothic"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""fill"":{""primaryColor"":""CMYK100,USER,191,173,167,230,100,00000000-0000-0000-0000-000000000000""" & _ ",""type"":""1"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""angle"":""0"",""outline"":{""color"":""CMYK,USER,80,40,0,20,100,00000000-0000-0000-0000-000000000000"",""width"":""0""}},""paragraph"":{""justify"":""2""},""fill"":{""primaryColor"":""CMYK,USER,0,0,0,100,100,00000000-0000-0000-0000-000000000000"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""outline"":{""leftArrow"":""|0"",""rightArrow"":""|0"",""color"":""CMYK255,USER,0,0,0,255,100,cccd19cb-4675-4a5e-8bda-d0bbbaab8af0"",""width"":""762""}}" OrigSelection(2).Style.StringAssign "{""dimension"":{""overhang"":""0"",""centerText"":""1"",""horizontalText"":""0"",""boxAroundText"":""0"",""textStyle"":""3"",""textPlacement"":""0"",""precision"":""3"",""units"":""0"",""useDefaultAnchorGap"":""1"",""angularUnits"":""1"",""showUnits"":""1"",""showLeadingZero"":""0"",""useDefaultOverhang"":""1"",""dynamicText"":""1"",""reverseTerminators"":""0"",""anchorGap"":""0"",""hideGapOnFreeExtension"":""1"",""radialTextAboveLine"":""0"",""labelGap"":""1"",""suffix"":"""",""useDefaultReverseTerminatedLength"":""1"",""radialInsideOutside"":""0"",""radialSymbol"":""4"",""hideCDWhenReverseTerminated"":""0"",""showInnerExtensionLines"":""1"",""prefix"":"""",""useDefaultLabelGap"":""1"",""showExtLines"":""1"",""dimetricSymbol"":""6"",""reverseTerminatedLength"":""0"",""autoReverseTerminator" & _ "s"":""1"",""includeCDReverseTerminated"":""0""},""character"":{""latin"":{""script"":""0"",""charset"":""0"",""weight"":""64"",""font"":""Verdana"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""v_shift"":""0"",""RTL"":{""script"":""0"",""charset"":""178"",""weight"":""64"",""font"":""Arial"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""h_shift"":""0"",""farEast"":{""script"":""0"",""charset"":""129"",""weight"":""64"",""font"":""Malgun Gothic"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""fill"":{""primaryColor"":""CMYK100,USER,191,173,167,230,100,00000000-0000-0000-0000-000000000000""" & _ ",""type"":""1"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""angle"":""0"",""outline"":{""color"":""CMYK,USER,80,40,0,20,100,00000000-0000-0000-0000-000000000000"",""width"":""0""}},""paragraph"":{""justify"":""2""},""fill"":{""primaryColor"":""CMYK,USER,0,0,0,100,100,00000000-0000-0000-0000-000000000000"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""outline"":{""leftArrow"":""|0"",""rightArrow"":""|0"",""color"":""CMYK255,USER,0,0,0,255,100,cccd19cb-4675-4a5e-8bda-d0bbbaab8af0"",""width"":""762""}}" OrigSelection(2).Style.StringAssign "{""dimension"":{""overhang"":""0"",""centerText"":""1"",""horizontalText"":""0"",""boxAroundText"":""0"",""textStyle"":""3"",""textPlacement"":""0"",""precision"":""3"",""units"":""0"",""useDefaultAnchorGap"":""1"",""angularUnits"":""1"",""showUnits"":""1"",""showLeadingZero"":""0"",""useDefaultOverhang"":""1"",""dynamicText"":""0"",""reverseTerminators"":""0"",""anchorGap"":""0"",""hideGapOnFreeExtension"":""1"",""radialTextAboveLine"":""0"",""labelGap"":""1"",""suffix"":"""",""useDefaultReverseTerminatedLength"":""1"",""radialInsideOutside"":""0"",""radialSymbol"":""4"",""hideCDWhenReverseTerminated"":""0"",""showInnerExtensionLines"":""1"",""prefix"":"""",""useDefaultLabelGap"":""1"",""showExtLines"":""1"",""dimetricSymbol"":""6"",""reverseTerminatedLength"":""0"",""autoReverseTerminator" & _ "s"":""1"",""includeCDReverseTerminated"":""0""},""character"":{""latin"":{""script"":""0"",""charset"":""0"",""weight"":""64"",""font"":""Verdana"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""v_shift"":""0"",""RTL"":{""script"":""0"",""charset"":""178"",""weight"":""64"",""font"":""Arial"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""h_shift"":""0"",""farEast"":{""script"":""0"",""charset"":""129"",""weight"":""64"",""font"":""Malgun Gothic"",""underline"":""0"",""overline"":""0"",""effect"":""0"",""italic"":""0"",""size"":""35277"",""strikeout"":""0""},""fill"":{""primaryColor"":""CMYK100,USER,191,173,167,230,100,00000000-0000-0000-0000-000000000000""" & _ ",""type"":""1"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""angle"":""0"",""outline"":{""color"":""CMYK,USER,80,40,0,20,100,00000000-0000-0000-0000-000000000000"",""width"":""0""}},""paragraph"":{""justify"":""2""},""fill"":{""primaryColor"":""CMYK,USER,0,0,0,100,100,00000000-0000-0000-0000-000000000000"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""outline"":{""leftArrow"":""|0"",""rightArrow"":""|0"",""color"":""CMYK255,USER,0,0,0,255,100,cccd19cb-4675-4a5e-8bda-d0bbbaab8af0"",""width"":""762""}}" ActiveDocument.EndCommandGroup
I'm still trying to figure this out. Is there some simple way to view or apply these styles to an object?
There is a really simple way that works in (I think) X5, but somewhere along the way that got broken in some newer version.
You might look at this thread - Are there any existing Macros to find any and all Dynamic Dimensions and turn them off?.
Mek showed some ways to use Style.GetProperty and Style.SetProperty to access dimension styles for the sake of changing properties of dimensions.
As another option: have you considered creating style sets with all of the desired dimension properties in them, and then applying those style sets to manage dimension formatting?
Thank you Eskimo, I will look into that. I'm also trying to set the endpoints of my dimensions when I run a specific macro that changes the text position to top or bottom. I have recorded a script to apply the end styles but the code is so damn convuluted and hard to navigate...all I can think of is find the 'RightArrow / LeftArrow' sections but that's about it.
Regarding the object styles - yes I have set them but as soon as I run my dimension top/bottom macro I lose the endpoints.
I got the right arrow to work with the arrow100 (small dot) end but my left arrow code is mucked somehow. I can't figure out what's missing or redundant. Can someone take a look?
*this code changes the endpoints of a dimension line.
OrigSelection(2).Style.StringAssign "{""fill"":{""primaryColor"":""CMYK,USER,0,0,0,100,100,00000000-0000-0000-0000-000000000000"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""outline"":{""rightArrow"":""M0,127000 C69850,127000 127000,69977 127000,0 C127000,-69977 69850,-127000 0,-127000 C-69850,-127000 -127000,-69977 -127000,0 C-127000,69977 -69850,127000 0,127000 Z|"0"",""leftArrow"":""M0,127000 C69850,127000 127000,69977 127000,0 C127000,-69977 69850,-127000 0,-127000 C-69850,-127000 -127000,-69977 -127000,0 C-127000,69977 -69850,127000 0,127000 Z|0"",""width"":""1016"",""color"":""RGB255,USER,0,0,0,100,8273965b-a0fd-4e34-a5c2-a29720146cc3""},""character"":{""fill"":{""primaryColor"":""CMYK100,USER,255,255,255,255,100,00000000-0000-0000-0000-000000000000"",""type"":""1"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000""},""angle"":""0"",""outline"":{""width"":""0"",""color"":""CMYK,USER,80,40,0,20,100,00000000-0000-0000-0000-000000000000""},""RTL"":{""charset"":""178"",""size"":""35277"",""weight"":""64"",""italic"":""0"",""font"":""Andalus"",""strikeout"":""0"",""effect"":""0""" & _ ",""script"":""0"",""underline"":""0"",""overline"":""0""},""h_shift"":""0"",""v_shift"":""0"",""latin"":{""charset"":""0"",""size"":""35277"",""weight"":""64"",""italic"":""0"",""font"":""Verdana"",""strikeout"":""0"",""effect"":""0"",""script"":""0"",""underline"":""0"",""overline"":""0""},""farEast"":{""charset"":""129"",""size"":""35277"",""weight"":""64"",""italic"":""0"",""font"":""Batang"",""strikeout"":""0"",""effect"":""0"",""script"":""0"",""underline"":""0"",""overline"":""0""},""jp78"":""0"",""jp83"":""0"",""frac"":""0"",""expt"":""0"",""jp90"":""0"",""afrc"":""0"",""numr"":""0"",""dnom"":""0"",""smpl"":""0"",""nalt"":""0"",""ornm"":""0""},""paragraph"":{""justify"":""2""},""dimension"":{""precision"":""3"",""showLeadingZero"":""0"",""textPlacement"":""0"",""useDefaultAnchorGap""" & ":""0"",""dynamicText"":""0"",""textStyle"":""1"",""overhang"":""10000"",""anchorGap"":""10000"",""useDefaultOverhang"":""0""}}"