0

I am putting below custom code in SSRS report,

Option Explicit

Private Sub Workbook_Open()
    Application.ErrorCheckingOptions.BackgroundChecking = False
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.ErrorCheckingOptions.BackgroundChecking = True
End Sub

But it's giving me compilation error as below,

Severity Code Description Project File Line Suppression State Error [rsCompilerErrorInCode] There is an error on line 1 of custom code: [BC30627] 'Option' statements must precede any declarations or 'Imports' statements.

Do I need to include any library or namespace for this?

Keval Patel
  • 925
  • 4
  • 24
  • 46

1 Answers1

0

I believe that SSRS custom code is included amidst the other code that is used by SSRS. Since your code is not the first code block to be executed, you can't use the OPTION EXPLICIT statement.

Wes H
  • 4,186
  • 2
  • 13
  • 24