Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Im using a Column Adjustmant macro to set the column width.
Im a Macro suggested by Gysbert Wassenaar
Sub
set val=ActiveDocument.Fields("Date").GetSelectedValues
ColCount = val.count
ColWidth = 2000/ColCount
if ColWidth > 200 then ColWidth = 200
if ColWidth < 20 then ColWidth = 20
set chart = ActiveDocument.GetSheetObject( "CH01" )
chart.SetPixWidth val.count,ColWidth
end sub
it's working great except when I clear selection the macro fails (I guess since ColCount= 0 and we devide by 0)
Im trying to overcome this by using GetPossibleCount in a variable and sending it to the function
but I cannot get it working..
I will appreciate any help here. See attached file.
CAdjust1 is using the variable while CAdjust is without (doesn't work when I clear all)
Thanks in advance
Just to simplify my Question: How do I pass a variable to a function?
Im using this approach: func(($var)). But it doen't work )-:
any other ideas?
HI,
Try this.
set v = ActiveDocument.Variables("Variable1")
msgbox(v.GetContent.String)
Regards,
Kaushik Solanki
Thanks for the fast reply Kaushik
My variable is not a result of a function,
So when I use your suggestion I see : "GetPossibleCount(FunctionblockDesc)"
instead of the value of it.
Any suggesitons?
See attached (press on CAdjust1 button)
Hi,
Go to variable overview and add = at start of your expression.
Regards,
Kaushik Solanki
Thanks, only = didn't work.
I added =Num(GetPossibleCount(FunctionblockDesc)) and it shows the value.
But still when clearing selection it returns the number but opens the macro edit, as if there was an error.
Any Idea Why?
See attached, (press CAdjust1 button)
Sorry, My bad. there was another trigger that opened the error macro.
It works Now,
Thanks a lot!
Ori