I often use the following construct in my VBA code to track the progress of my code execution:
Public Sub Cmd3HideUnhide(sWksName As String, sHideUnhide As String)
On Error GoTo ErrHandler
Dim sProcNameCmd3 As String
sProcNameCmd3 = sWksName & ".HideUnhide.CmdBtn3HideUnhide"
other code
ErrHandler:
Call DspErrMsg(sProcNameCmd3)
End sub
When I run Project Analyzer it registers an error with the comment:
Variable read before written (along some path): sProcNameCmd3 in HideUnhide.Cmd3HideUnhide Type: Logic
As I have declared the variable sProcNameCmd3, assigned a value to this variable and later in the same procedure use that variable in a procedure call, I do not understand why this is referred to as "Variable read before written". Surely assigning a value to a variable constitutes writing the variable?
I also do not understand what I should do to rectify the problem.
I shall be grateful to assistance in this matter.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Expert of the Year award recognizes an expert who helped improve Experts Exchange in the past year through high levels of contributions and participation on site. This award is given to the expert who has achieved the highest levels of participation, while maintaining quality contributions and professionalism.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.