Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

open chart when certain field is selected

Hi!

I have a list box with a few indexes and a few chart which have sence only with selected index

Does anyone know how to realize macros wich will restore certain chart if certain field in list box is selected?

I've tried to make my own macro,but it didn't work. I know that a have a mistake here,but I can't understand where and why..((

Sub Test

Set obj = ActiveDocument.GetSheetObject("LB02")

Set fld = ActiveDocument.Fields("indexes")'

CurrVal = ActiveDocument.Fields("indexes").GetContent.String

if CurrVal = ActiveDocument.Fields("first_index") then


ActiveDocument.GetSheetObject("CH03").Restore

end if

End sub

Regards,Anton.

3 Replies
martin59
Specialist II
Specialist II

Hello,

You have to use the conditionnal show in your layout tab and formulas (GetFieldSelections(), GetPossibleCount(), Only()...)

Not applicable
Author

Thanks much!

but there is a claim that I have to make it with macro action[:'(]

do you know smth about it??

Not applicable
Author

I've found the solution,if smbd needs:

Sub CHART_OPEN

Set listBox = ActiveDocument.GetSheetObject("LB02")
Dim selectedCellText
For i = 0 To listBox.GetCardinal()-1
Set cell = listBox.GetCell(i,0)
If cell.state = 1 Then
selectedCellText = cell.Text
Exit For
End If
Next


If selectedCellText = "first_index" Then
ActiveDocument.GetSheetObject("CH12").Restore

End If


End Sub