troubleshooting Question

Variable read before written

Avatar of Jos te Braake
Jos te BraakeFlag for South Africa asked on
5 Comments1 Solution66 ViewsLast Modified:
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
       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.
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros