D
Deryck
Hi,
I'm relatively new to using VBA in Excel and hope that someone can help me
with the following:
1. I have written some scripts that work in one workbook but open another
for reading data. In order to make sure that this file is never corrupted I
close the file at the end of my scripts and make sure that any changes are
discarded:
Workbooks(dsName).Close SaveChanges:=False
Unfortunately I still get the message concerning a large amount of stuff
being in the clipboard and do I want to save it, Yes/No/Cancel? I want to
protect the user from this question (not least because the Cancel option
will crash my script!). How can I do this? Is there is a command to close a
file silently or is there a way to empty the clipboard? As a corollary to
that, is there a "best-practice" method of trapping errors so that the
scripts can fail gracefully?
2. I am sure that this is possible but I cannot figure it out: In a sheet
each row represents some money received. One column denotes what form this
money was received in, eg "Cheque" and column has all the cells blank until
one of the monies received is banked (when the user can put any text into
the cell). I would like to be able to count up all the cheques that have
been banked. Is it possible to do this with Countif? It is easy to count all
the monies that are cheques and all that have been banked but I am not sure
how to AND the query.
3. I have some class modules. In one particular use-case a class public
subroutine gets called and that calls another private subroutine in the
class. In the private subroutine the script would crash but if I went into
debug the highlighted code is the call to the first public subroutine. Why
does the debugger not go into the class module and is there a way that I can
make it do so? It would make debugging a lot easier!
Any help/advice would be much appreciated,
Deryck
I'm relatively new to using VBA in Excel and hope that someone can help me
with the following:
1. I have written some scripts that work in one workbook but open another
for reading data. In order to make sure that this file is never corrupted I
close the file at the end of my scripts and make sure that any changes are
discarded:
Workbooks(dsName).Close SaveChanges:=False
Unfortunately I still get the message concerning a large amount of stuff
being in the clipboard and do I want to save it, Yes/No/Cancel? I want to
protect the user from this question (not least because the Cancel option
will crash my script!). How can I do this? Is there is a command to close a
file silently or is there a way to empty the clipboard? As a corollary to
that, is there a "best-practice" method of trapping errors so that the
scripts can fail gracefully?
2. I am sure that this is possible but I cannot figure it out: In a sheet
each row represents some money received. One column denotes what form this
money was received in, eg "Cheque" and column has all the cells blank until
one of the monies received is banked (when the user can put any text into
the cell). I would like to be able to count up all the cheques that have
been banked. Is it possible to do this with Countif? It is easy to count all
the monies that are cheques and all that have been banked but I am not sure
how to AND the query.
3. I have some class modules. In one particular use-case a class public
subroutine gets called and that calls another private subroutine in the
class. In the private subroutine the script would crash but if I went into
debug the highlighted code is the call to the first public subroutine. Why
does the debugger not go into the class module and is there a way that I can
make it do so? It would make debugging a lot easier!
Any help/advice would be much appreciated,
Deryck