Roopher
Board Regular
- Joined
- Jul 8, 2008
- Messages
- 73
Hi together!
Having searched the forums I go crazy now with the following unsolved situation:
I declare a public variable in a *standard module* to be used throughout the project. I can use that variable in that module.
---
Option Explicit
Public psWorkbookName As String <-------------This one here!
Private Sub AddCompanySheet_Click()
code here
---
But, when I like to use that same variable within the *workbook event module* (Workbook_Deactivate() or the like), it is not recognised: autocomplete does not work, 'Variable not defined' error when runnig/compiling.
---
Option Explicit
Private Sub Workbook_Deactivate()
psWorkbookName = ActiveWorkbook.Name
End Sub
---
What is the big flaw here? Declaring the public variable in the event module's declaration section gives the same error the other way around: the standard module's procedures won't recognise it! Anyone can help???
Having searched the forums I go crazy now with the following unsolved situation:
I declare a public variable in a *standard module* to be used throughout the project. I can use that variable in that module.
---
Option Explicit
Public psWorkbookName As String <-------------This one here!
Private Sub AddCompanySheet_Click()
code here
---
But, when I like to use that same variable within the *workbook event module* (Workbook_Deactivate() or the like), it is not recognised: autocomplete does not work, 'Variable not defined' error when runnig/compiling.
---
Option Explicit
Private Sub Workbook_Deactivate()
psWorkbookName = ActiveWorkbook.Name
End Sub
---
What is the big flaw here? Declaring the public variable in the event module's declaration section gives the same error the other way around: the standard module's procedures won't recognise it! Anyone can help???
Last edited: