Still working on my pricing macro and getting stuck on how to position the price group to where I want it.I'm trying to get it to the blank area but not sure the best way to go about it.
Private Sub Make_Click() Dim Dlr As Shape Dim Cnt As Shape Dim Sym As Shape Dim Tax As Shape Dim Pk As Shape Dim Price As Shape Dim TextType As String Dim X As Double, Y As Double, w As Double, h As Double Const space_dist As Double = 0.1 Dim sr As New ShapeRange Set Dlr = ActiveLayer.CreateArtisticText(0, 0, PriceFrm.Dollar.Value, , , BrandFont.Value, 100) Set Cnt = ActiveLayer.CreateArtisticText(0, 0, PriceFrm.Cents.Value, , , BrandFont.Value, 50) Set Sym = ActiveLayer.CreateArtisticText(0, 0, "$", , , BrandFont.Value, 50) Set Tax = ActiveLayer.CreateArtisticText(0, 0, PriceFrm.Tax_Options.Value, , , BrandFont.Value, 9, , , , cdrCenterAlignment) 'Cent Position Cnt.AlignToShape cdrAlignTop, Dlr Cnt.LeftX = Dlr.RightX + space_dist '$ Position Sym.AlignToShape cdrAlignTop, Dlr Sym.RightX = Dlr.LeftX - 0.07 'Tax Position Cnt.GetBoundingBox X, Y, w, h Tax.SetSize w Tax.AlignToShape cdrAlignHCenter, Cnt Tax.TopY = Cnt.BottomY - 0.07 'Select & Group Price sr.Add Dlr sr.Add Cnt sr.Add Sym sr.Add Tax sr.Group.Name = "$" & PriceFrm.Dollar.Value & "." & PriceFrm.Cents.Value sr.GetBoundingBox X, Y, w, h 'Add Package If Pk_MultiPage.Value = 0 Then 'Standard Set Pk = ActiveLayer.CreateArtisticText(0, 0, Pk_Options_Std.Value, , , BrandFont.Value, 9, , , , cdrCenterAlignment) Pk.SetSize w Pk.CenterX = sr.Group.CenterX Pk.TopY = sr.Group.BottomY - 0.1 Pk.Name = Pk_Options_Std.Value Else If Pk_MultiPage.Value = 1 Then 'Stacked Set Pk = ActiveLayer.CreateArtisticText(0, 0, Pk_Options_Stk.Value, , , BrandFont.Value, 9, , , , cdrCenterAlignment) Pk.SetSize w Pk.CenterX = sr.Group.CenterX Pk.TopY = sr.Group.BottomY - 0.1 Pk.Text.Story.LineSpacing = 73.638 Pk.Name = Pk_Options_Stk.Value Else If Pk_MultiPage.Value = 2 Then 'Narrow Set Pk = ActiveLayer.CreateArtisticText(0, 0, Pk_Options_Nw.Value, , , BrandFont.Value, 9, , , , cdrCenterAlignment) Pk.Text.Story.LineSpacing = 73.638 Pk.SetSize , Dlr.SizeHeight Pk.LeftX = sr.Group.RightX + 0.15 Pk.CenterY = sr.Group.CenterY Pk.Name = Pk_Options_Nw.Value End If End If End If 'Group and Rename ActiveLayer.Shapes(2).AddToSelection ActiveSelection.Group.Name = "$" & PriceFrm.Dollar.Value & "." & PriceFrm.Cents.Value 'Text Brand Colors If BrandFont.Value = "Bud Bold" Then ActiveSelection.Fill.UniformColor.CMYKAssign 75, 68, 65, 90 Else If BrandFont.Value = "TitlingGothicFB Comp Medium" Then ActiveSelection.Fill.UniformColor.CMYKAssign 75, 35, 0, 0 Else If BrandFont.Value = "Gotham Bold" Then ActiveSelection.Fill.UniformColor.CMYKAssign 100, 87, 0, 20 Else If BrandFont.Value = "Trade Gothic LT Std Bold" Then ActiveSelection.Fill.UniformColor.CMYKAssign 100, 96, 26, 21 Else If BrandFont.Value = "TradeGothic" Then ActiveSelection.Fill.UniformColor.CMYKAssign 75, 68, 65, 90 Else If BrandFont.Value = "Futura Md BT" Then ActiveSelection.Fill.UniformColor.CMYKAssign 75, 68, 65, 90 End If End If End If End If End If End If End Sub
I don't know what the best way is for you to accomplish what you want here.
For some of the stuff with which I work, I find it useful to have some "reference content" - e.g., rectangles and lines - on a non-printing layer. I can use those objects as references when aligning or snapping the printable content.
If you named such a reference object, you could "find it by name" in your VBA code, and then use that to position and/or resize the pricing content you are creating.
Yeah, that's the solution I ended up taking. Making a rectangle for the remaining blank space and using it as a reference for aligning the pricing.
Hey, glad you worked it out to your satisfaction!
Looking at your code, I'll point out something that you might find useful, especially if you are dealing with more choices. It's Select Case.
Instead of a bunch of If-Then-Else, it might look like this:
Select Case BrandFont.Value Case "Bud Bold" ActiveSelection.Fill.UniformColor.CMYKAssign 75, 68, 65, 90 Case "Gotham Bold" ActiveSelection.Fill.UniformColor.CMYKAssign 100, 87, 0, 20 Case "Trade Gothic LT Std Bold" ActiveSelection.Fill.UniformColor.CMYKAssign 100, 96, 26, 21 Case "TradeGothic" ActiveSelection.Fill.UniformColor.CMYKAssign 75, 68, 65, 90 Case "Futura Md BT" ActiveSelection.Fill.UniformColor.CMYKAssign 75, 68, 65, 90 Case Else 'Put code here to do something if it is none of the above. End Select
I didn't actually run any of that code, so I might have a typo or other error in there, but you get the idea, and you can find more details online.
Ahh! So much cleaner! Got it working and swapped it out.