Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have following code of marcos,When i Write (end if).before end sub it will not work,,and when i remove it work fine
sub TrendByTimeSwitch()
set trend_by = ActiveDocument.Fields("Trend_By_Time")
set values = trend_by.GetSelectedValues
if values(0).text = "Quarter" then
ActiveDocument.Fields("C.Quarter").selectPossible
ActiveDocument.Fields("C.Year_Month").clear
ActiveDocument.Fields("C.Discharge_Year").clear
ActiveDocument.Fields("C.FY_Year").clear
ActiveDocument.Fields("C.R4Q").clear
elseif values(0).text = "Month" then
ActiveDocument.Fields("C.Year_Month").selectPossible
ActiveDocument.Fields("C.Quarter").clear
ActiveDocument.Fields("C.Discharge_Year").clear
ActiveDocument.Fields("C.FY_Year").clear
ActiveDocument.Fields("C.R4Q").clear
elseif values(0).text = "CY" then
ActiveDocument.Fields("C.Discharge_Year", "QASheet").selectPossible
ActiveDocument.Fields("C.Quarter", "QASheet").clear
ActiveDocument.Fields("C.Year_Month", "QASheet").clear
ActiveDocument.Fields("C.Fiscal_Year", "QASheet").clear
ActiveDocument.Fields("C.R4Q", "QASheet").clear
elseif values(0).text = "FY" then
ActiveDocument.Fields("C.Fiscal_Year", "QASheet").selectPossible
ActiveDocument.Fields("C.Quarter", "QASheet").clear
ActiveDocument.Fields("C.Year_Month", "QASheet").clear
ActiveDocument.Fields("C.Discharge_Year", "QASheet").clear
ActiveDocument.Fields("C.R4Q", "QASheet").clear
elseif values(0).text = "R4Q" then
ActiveDocument.Fields("C.R4Q", "QASheet").selectPossible
ActiveDocument.Fields("C.Quarter", "QASheet").clear
ActiveDocument.Fields("C.Year_Month", "QASheet").clear
ActiveDocument.Fields("C.Discharge_Year", "QASheet").clear
ActiveDocument.Fields("C.Fiscal_Year", "QASheet").clear
endif
end sub
write End If nor EndIf (The space between end and if
let me know
end if after writing error comes..when i remove it works
The syntax is:
If condition Then
[Statements]
[ElseIf condition-n] Then [Statements]
[Else]
[Statements]
End If
so it should need End If, try to evaluate each if and verify if it works.
hi,
there must be a space between end if.
May be missing a ";" at the end of a sentence?