1

I was gonna transfer my code from button to agent, but when I put this on my declarations:

Dim s As NotesSession
Dim db As NotesDatabase

Dim doc As NotesDocument
Dim view As NotesView
Dim coll As NotesDocumentCollection
Dim item As NotesItem
Dim Formula As String 'Public symbol is declared in another module: Formula

Dim authors() As Variant 'Public symbol is declared in another module: AUTHORS
Dim authorlist() As Variant

I'm having this Public symbol is declared in another module I can't seem to find out whats going on coz its just a declarations. Can you help me out?

drayl
  • 261
  • 2
  • 8
  • 21

2 Answers2

3

Are you using any script libraries in your agent? This error comes up when you are using same variable or function name already declared in your script library.

From help documentation:

Public symbol is declared in another module: <name>

A name declared as Public has already been declared as Public in another loaded module. A name can be declared as Public in only one loaded module at a time. Other loaded modules can only reference that name.

Remove Public from the declaration, or change the Public name so that it does not conflict with the name in the already loaded module.

Also have a look at this and this.

Naveen
  • 6,786
  • 10
  • 37
  • 85
3

So I take it you are pasting it directly into the main source window and not the Initialize section.

If so, what is happening is your variables are hitting reserved keywords. To work around this issue, change the names or declare them within a method.

Example:

Sub Initialize
    Dim s As NotesSession
    Dim db As NotesDatabase

    Dim doc As NotesDocument
    Dim view As NotesView
    Dim coll As NotesDocumentCollection
    Dim item As NotesItem
    Dim Formula As String 'Public symbol is declared in another module: Formula

    Dim authors() As Variant 'Public symbol is declared in another module: AUTHORS
    Dim authorlist() As Variant
    Dim editors() As Variant
End Sub
Simon O'Doherty
  • 9,259
  • 3
  • 26
  • 54
  • 1
    This is a "Best Practice" in that it isolates the variables to the agent and does not risk damaging data outside the process. – Newbs Aug 05 '13 at 18:48