Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / November 2007

Tip: Looking for answers? Try searching our database.

Changing Watch variable value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
k2c - 28 Nov 2007 21:47 GMT
Hello, for testing purposes, I would like to change the value of the Watch
variables that I have added to the Watch Window.  It appears that I can add,
delete or change the names, but the content itself cannot be altered.  Is
there a way to do it as part of the functionality of the Watch Window
feature?  Thanks.
JMB - 29 Nov 2007 03:57 GMT
Try changing it in the Immediate window.

> Hello, for testing purposes, I would like to change the value of the Watch
> variables that I have added to the Watch Window.  It appears that I can add,
> delete or change the names, but the content itself cannot be altered.  Is
> there a way to do it as part of the functionality of the Watch Window
> feature?  Thanks.
k2c - 29 Nov 2007 21:13 GMT
I opened an Immediate window, and tried the following:

(1) Typed in the variable and its value that I wish to test.  Nothing
happened.
(2) Defined the variable, then assigned its value.  Didn't work either.

I want to test a subroutine which uses a variable to pass the number of
columns for various reports.  I would like to assign different values to this
variable so that I can test this subroutine.  Sounds simple & elementary I
thought, but I'm having a hard time.  

Please pardon my ignorance, I'm new to VB and its editor...



> Try changing it in the Immediate window.
>
[quoted text clipped - 3 lines]
> > there a way to do it as part of the functionality of the Watch Window
> > feature?  Thanks.
JMB - 30 Nov 2007 02:25 GMT
As an example of what I'm getting at, if I had the following two macros:

Sub test()
Macro1 5
End Sub

Sub Macro1(lngVar As Long)
lngVar = lngVar * 2
'Change value in the immediate window
MsgBox lngVar
End Sub

If I stepped through Test (F8 key) and passed 5 to Macro1, I can enter:
lngVar = 17
in the Immediate Window and this will change the value of the lngVar
variable.  By resuming to step through the macro (F8), the message box
confirms the value of the variable was changed.  Is this what you were
wanting to do??

> I opened an Immediate window, and tried the following:
>
[quoted text clipped - 18 lines]
> > > there a way to do it as part of the functionality of the Watch Window
> > > feature?  Thanks.
k2c - 30 Nov 2007 17:54 GMT
You got the idea, this is an alternative of what I want to do.  I've worked
with a debugger years ago where this feature is included in the "watch"
window.  The value of any variable listed in the watch window could be change
anytime or at a breakpoint - much simpler & convenient.  At least this
confirms my obstacle with the VB editor.  Thanks much for your help!

> As an example of what I'm getting at, if I had the following two macros:
>
[quoted text clipped - 37 lines]
> > > > there a way to do it as part of the functionality of the Watch Window
> > > > feature?  Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.