Run-time error '9': Subscript out of range - Excel booking form with email macro

luke.sykes

New member
Joined
Sep 25, 2015
Messages
1
Reaction score
0
Points
0
Hi All

I have a booking form we use to book VideoConferences and for some reason on the latest version the user gets the afore mentioned error.



I have seen lots of posts and questions on this but none that relate to my exact issue.



When the user clicks submit, the macro emails the completed form (Sheet only) to the dedicated inbox without a problem but then they get the runtime error and think its not worked, so submit it again. Its becoming a real problem and no matter what I do I just cant get my head around it.



The whole form is made up of 5 sheets;



Home
New_Booking
Amendment
Cancellation
Support



With a Submit button on pages



New_Booking
Amendment
Cancellation



Which has a macro to send that single sheet as an email attachment as per Ron De Bruins code

First of all I tried using modules to house the code which retuned the error. My thinking was that perhaps the sheet has been emailed and can no longer see the module as the module is part of the workbook and not that worksheet. After that so I pasted the code into the sheets VBA field instead but the error still comes up.



I am totally out of ideas, please help



Kind regards



Luke
 
This error can occur for a number of different reasons. A common one is that a sheet that doesn't exist is referenced in the code, and another is where you have an array that has either not been dimensioned, or the element being processed exceeds the current dimension.
What you must do is try to find the code statement that produces the error, and in particular if it always happens at the same point. You can do this by using the debugger to trap the error.
Also, you refer to the latest version, suggesting that the coding has been changed. If so, its likely that there is a bug here thats been missed when the changes were tested. Try to get details of what changes were made. Look for new or amended range objects or worksheets, or arrays.
You can also use the Locals window in debug. This enables you to see if objects you are referencing actually exist at the time, which can be a problem if other parts of your code remove objects after they have used them.
You may be facing a problem that will take some working out, so if your not an experienced VBA user you may want to refer the problem to the system developer.
 
Back
Top