D
Dymondjack
I've recently discovered that you can simulate a carriage return in the VBA
code window (for lack of a better phrase) using a colon
ex.
Case 0: strString = ""
instead of the usual
Case 0
strString = ""
I see this used a little bit here and there, but really know nothing about
using a colon in vba programming (I know the colon has a very significant
meaning most programming languages, but vba is all I really know). Searches
on the subject have left me unsatisfied (though I've learned that certain
parameters can be set using := ) <-- not a smiley...
Anyway I was hoping someone might be able to shed some light on it. With so
many ways to condense code by utilizing this, I would think it would be seen
plastered everywhere rather than just here and there. I know there has to be
much more to this picture, I just can't seem to find it.
Consider this code:
'start code
Function fCmdSubst(aDrive As String, aPath As String) As Double
On Error Goto Error_Function
Dim x: x = 1 / 0
Exit_Function: Exit Function
Error_Function: MsgBox ("Error"): GoTo Exit_Function
End Function
'end code
Obviously these code examples are rather weak in functionality, but the
implications behind the concept are rather broad I think, especially in
redundant procedure openings and closings.
Anyone that might be able to provide feedback or links on drawbacks (or
anything else) regarding this, it would be very much appreciated. I would
love to utilize this in an effort to better organize my code, but am afraid
of playing with fire as I am uneducated in the subject...
Many TIA!
-jack
code window (for lack of a better phrase) using a colon
ex.
Case 0: strString = ""
instead of the usual
Case 0
strString = ""
I see this used a little bit here and there, but really know nothing about
using a colon in vba programming (I know the colon has a very significant
meaning most programming languages, but vba is all I really know). Searches
on the subject have left me unsatisfied (though I've learned that certain
parameters can be set using := ) <-- not a smiley...
Anyway I was hoping someone might be able to shed some light on it. With so
many ways to condense code by utilizing this, I would think it would be seen
plastered everywhere rather than just here and there. I know there has to be
much more to this picture, I just can't seem to find it.
Consider this code:
'start code
Function fCmdSubst(aDrive As String, aPath As String) As Double
On Error Goto Error_Function
Dim x: x = 1 / 0
Exit_Function: Exit Function
Error_Function: MsgBox ("Error"): GoTo Exit_Function
End Function
'end code
Obviously these code examples are rather weak in functionality, but the
implications behind the concept are rather broad I think, especially in
redundant procedure openings and closings.
Anyone that might be able to provide feedback or links on drawbacks (or
anything else) regarding this, it would be very much appreciated. I would
love to utilize this in an effort to better organize my code, but am afraid
of playing with fire as I am uneducated in the subject...
Many TIA!
-jack