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 / New Users / July 2007

Tip: Looking for answers? Try searching our database.

VB exiting silently and inexplicably

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Iain King - 03 Jul 2007 10:44 GMT
My vb code is mysteriously aborting without any error or warning.
It's got me puzzled in the extreme.  The following code copies values
from cells from one sheet into the columns of a row on a second sheet
(with debugging stuff added):

   For Each n In ScanSetup.Names
       If Left(n.Name, 4) = "EDIT" And n.Name <> "EDIT_ClientTitle"
Then
           tail = Mid(n.Name, 6)
           Debug.Print Sheets("Records").Cells(row, Range("RECORDS_"
+ tail).Column).Value
           Debug.Print Sheets("Edit").Range(n.Name).Value
           Stop
           Sheets("Records").Cells(row, Range("RECORDS_" +
tail).Column).Value = _
              Sheets("Edit").Range(n.Name).Value
           Stop
       End If
   Next

It prints off the debugs fine, so the cell references are ok.  It hits
the first stop, but then terminates.  The value in the destination
cell is unchanged.  Any ideas?

Iain
Dave Peterson - 03 Jul 2007 13:05 GMT
I'd double check the range names.  Maybe they're not what you expect.

To make your checking easier, get Jan Karel Pieterse's (with Charles Williams
and Matthew Henson) Name Manager:

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp

> My vb code is mysteriously aborting without any error or warning.
> It's got me puzzled in the extreme.  The following code copies values
[quoted text clipped - 21 lines]
>
> Iain

Signature

Dave Peterson

Iain King - 06 Jul 2007 10:08 GMT
> I'd double check the range names.  Maybe they're not what you expect.
>
[quoted text clipped - 33 lines]
>
> Dave Peterson

The names are accurate - otherwise the debug.prints wouldn't work.

Iain
Mark Lincoln - 09 Jul 2007 19:34 GMT
Your Stop statement seems to be acting like an End statement--but that
should only happen if the code is in a compiled executable
(i.e., .exe) file.  Is it in an .exe file?

Mark Lincoln

> My vb code is mysteriously aborting without any error or warning.
> It's got me puzzled in the extreme.  The following code copies values
[quoted text clipped - 21 lines]
>
> Iain
Iain King - 10 Jul 2007 09:39 GMT
> Your Stop statement seems to be acting like an End statement--but that
> should only happen if the code is in a compiled executable
[quoted text clipped - 27 lines]
>
> > Iain

The Stop statements are just for debugging.  If I take them out the
code exits at teh same point.  (Really, the stops are just break
points I can type into usenet so you can see where they are.)  It's
the line between the Stops which is acting like an End statement - the
cell is not getting set.

Iain
 
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.