Click to See Complete Forum and Search --> : Searching for unused variables
Mark Sreeves
Dec 14th, 1999, 04:19 PM
Before I write one myself....
Does anyone know of an AddIn which searches through [VB5] source code and lists unused or duplicated variables?
------------------
Mark Sreeves
Analyst Programmer
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
Juillet
Dec 14th, 1999, 05:50 PM
If you use Option Explict at the head of your code you can't have duplictate variables....so that is one way of finding duplicates...when you recompile it will point them out.
Mark Sreeves
Dec 14th, 1999, 05:58 PM
You CAN have duplicates!
by which I mean two variables of with the same name in scope at once.
try this:
Option Explicit
Dim x As Integer
Private Sub Form_Load()
x = 1
End Sub
Private Sub Command1_Click()
Dim x As Integer
x = 2
MsgBox x
End Sub
------------------
Mark Sreeves
Analyst Programmer
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
Serge
Dec 14th, 1999, 06:04 PM
I don't know if there's any Add-In for this, but you are right, you can write one yourself.
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
Mark Sreeves
Dec 14th, 1999, 06:05 PM
Thanks for that serge :)
------------------
Mark Sreeves
Analyst Programmer
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.