Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Say I have a field test with values a,b,c...
I have objects created with the layout condition based on the selection of the value of the list object.
Obviously, when I select random values, the objects will not be aligned. But is there a way to align the visible objects in a specific order??
Like in the image
Please help.
Hi,
FUNCTION pox(obj,x,y)
set obj = ActiveDocument.GetSheetObject(obj)
pos = obj.GetRect
pos.Top =y
pos.Left =x
obj.SetRect pos
END FUNCTION
sub move_obj
SET val=ActiveDocument.Fields("Field").GetPossibleValues(1)
ValueToSelect = val.Item(0).Text
select case ValueToSelect
case "a"
call pox("TX01",339,47)
call pox("TX02",488,196)
call pox("TX03",636,349)
case "b"
call pox("TX01",333,349)
call pox("TX02",488,196)
call pox("TX03",644,43)
case "c"
call pox("TX01",330,196)
call pox("TX02",488,196)
call pox("TX03",649,199)
end select
END sub
Hi,
1 option:
SUB TOP_LEFT
set sh = ActiveDocument.ActiveSheet
for i = 0 to sh.NoOfSheetObjects-1
set obj = sh.SheetObjects(i)
pos = obj.GetRect
pos.Top = pos.Top + 20
pos.Left = pos.Left + 15
obj.SetRect pos
next
END SUB
Thanks for the reply,
The script only moves all the objects in the sheet by 20/15. That's it. But I need only the selected objects to align in an order. Like I should read the values of the ending of the object and align next object based on that value. Maybe we can achieve this using macro. But am very poor in VBScript and javascript.:( So expecting some help.
Hi,
Thank you Fer, that definetly helps as a base to write some complex functionality. Can you please paste here the script??
Hi,
FUNCTION pox(obj,x,y)
set obj = ActiveDocument.GetSheetObject(obj)
pos = obj.GetRect
pos.Top =y
pos.Left =x
obj.SetRect pos
END FUNCTION
sub move_obj
SET val=ActiveDocument.Fields("Field").GetPossibleValues(1)
ValueToSelect = val.Item(0).Text
select case ValueToSelect
case "a"
call pox("TX01",339,47)
call pox("TX02",488,196)
call pox("TX03",636,349)
case "b"
call pox("TX01",333,349)
call pox("TX02",488,196)
call pox("TX03",644,43)
case "c"
call pox("TX01",330,196)
call pox("TX02",488,196)
call pox("TX03",649,199)
end select
END sub