I have recently upgraded to Office 2010 at work and there are a few things that are a real problem for me. As a T-SQL developer and SQL Server DBA I copy and paste code to and from various applications and if Word gets involved it can has disastrous consequences. There is an option that appears to be defaulted to “on” that changes a straight quote to what Word describes as a smart quote – see the image below. Note – the single quote suffers from the same effect.
Now, getting to the point that Word doesn’t apply smart-quotes and therefore destroy your ability to paste the content into the SSMS Code Editor and execute it is a pretty arduous task. It isn’t just a case of making a change and it’s all over. Oh no, there are potentially four places where you need to make changes in order to be able to copy and paste without concern of getting syntax errors.
In Word, head to the File menu and then enter the Options dialog…
From here head to the Proofing tab and click the Autocorrect options button.
Now you have to visit two of the tabs in the Autocorrect dialog and un-tick the “Straight quotes with smart quotes” option on both of them. Simple enough, just a lot of clicking.
And why in two places? No idea!
Someone at Microsoft must have had a good reason for it, or
there are two development teams that didn’t communicate too well about how this should work.
Now, I mentioned you have to do this is four places earlier. That’s because if you ever want to share your code via email and you use Outlook then you have to do the same again. Open a new email and then follow the steps above from the point where you select the File menu. The dialogs are the same.
You should now be able to use Word and Outlook to share code without anything inside single or double quotes being altered in the process.