Sorry for the late reply, but I had problems understanding the override. However, I realised that the path you gave me was slightly wrong. Should have been templates/your-template/html/com_virtuemart/sublayouts/addtocartbar.php (I should have realised but I haven't done any overrides before).
For those interested, this is what I did:
In CONFIGURATION...SHOPFRONT...ACTION WHEN A PRODUCT IS OUT OF STOCK choose "Displays notify me instead of add to cart button"
I then went to Joomla menu EXTENSIONS...LANGUAGE(S)...OVERRIDES. In the LANGUAGE CONSTANT box I put COM_VIRTUEMART_CART_NOTIFY (this is the constant that currently says "Notify Me" when the item is out of stock). I then put in the TEXT box "Sorry, this item is sold".
Now when an item is out of stock instead of "notify me" it says "sorry, this item is out of stock".
This is almost good enough, but the words are still a clickable link which I don't want. So I copied addtocartbar.php as Jorgen kindly showed me in this post. I then removed the code that created a link and left just the text.
REPLACE: <a href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' . $product->virtuemart_product_id); ?>" class="notify"><?php echo vmText::_ ('COM_VIRTUEMART_CART_NOTIFY') ?></a>
WITH: <?php echo vmText::_ ('COM_VIRTUEMART_CART_NOTIFY') ?>So now when an item is out of stock, it can be displayed and labelled as out of stock and not orderable.
Maybe this will help someone.
Many thanks to Jorgen for pointing me in the right direction.
Dave