Need macro to display a default value while opening the repo

Hi All,

I have a macro for settign a default value in the prompt while refreshing the report. But i dont have the macro for the same while opening the report. Could any body help out me for using the macro. The macro which i am using for setting the default value while refreshing is below.
Private Sub Document_BeforeRefresh(Cancel As Boolean)

Dim i As Integer
For i = 1 To ActiveDocument.Variables.Count
If ActiveDocument.Variables.Item(i).IsUserPrompt = True Then
If ActiveDocument.Variables.Item(i).Name = “PROMPT TEXT” Then
ActiveDocument.Variables.Item(i).Value = “VALUE”
End If
End If
Next i
End Sub

Thanks in advance.

LPERS.


lpers :india: (BOB member since 2008-09-26)

You have to run the above code in the document_open event of ThisDocument and set the report to refresh on open

.


haider :es: (BOB member since 2005-07-18)