Forming 40 S&W shot shell cartridges is a possibility but whether it is worth the effort or not is the question. This assumes a case is available with the appropriate head size.
A simple internet search brings up lots of information, or lack of information on the subject.
I did not find any 40 S&W shot shell forming dies in my brief search. Call RCBS, they may have design in inventory and just need some cash to get one set on the production schedule.
RCBS makes 45 ACP shot shell from 308 Winchester forming dies. These dies could be copied and resized appropriately for 40 S&W. (Some body makes blank die bodies for custom work).
See here.
http://www.huntingtons.com/store/product.php?productid=17967&cat=875&page=1
Here is a web site talking about making a variety of handgun shot shell cartridges. I just scanned it quickly but it may have some useful information.
http://www.gunweek.com/2005/feature1001.html
If you are only making a relative few shot cartridges, the home made custom dies do not need to be hardened but be aware they are damaged easily.
Then, you have to come up with under and over shot wads.
If you like doing this kind of stuff, a worth while project. If you are trying to circumvent the shortage of factory shot shells, maybe not so worth while when other options are available.
Hope this helps.