{"id":69253,"date":"2005-08-03T18:41:00","date_gmt":"2005-08-03T18:41:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/08\/03\/how-can-i-insert-a-symbol-into-a-word-document\/"},"modified":"2005-08-03T18:41:00","modified_gmt":"2005-08-03T18:41:00","slug":"how-can-i-insert-a-symbol-into-a-word-document","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-insert-a-symbol-into-a-word-document\/","title":{"rendered":"How Can I Insert a Symbol into a Word Document?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" height=\"34\" alt=\"Hey, Scripting Guy! Question\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\"> \n<P>Hey, Scripting Guy! How can I insert a Wingding symbol into a Word document?<BR><BR>&#8212; RC<\/P><IMG height=\"5\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" border=\"0\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" height=\"34\" alt=\"Hey, Scripting Guy! Answer\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" height=\"288\" alt=\"Script Center\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" align=\"right\" border=\"0\"><\/A> \n<P>Hey, RC. In case you\u2019re wondering, there were two reasons why we decided to answer your question. First, we just liked the phrase <I>insert a Wingding symbol<\/I>. (No, we don\u2019t know <I>why<\/I> we liked it, we just did.) Second &#8211; and by far most important &#8211; this is an easy one, one we can answer with just a few lines of code.<\/P>\n<P>As we\u2019ll see, the code for inserting a symbol into a Word document is trivial; what\u2019s tricky is figuring out which symbol you want to insert (as well as the character code for that symbol). Perhaps the easiest way to do this (although we\u2019ll show you another method at the end of today\u2019s column) is to open up the <B>Symbol<\/B> dialog box, select the desired font, and then click on the symbol you want to insert:<\/P><IMG height=\"294\" alt=\"Microsoft Word Symbols\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/qanda\/symbols.jpg\" width=\"400\" border=\"0\"> \n<P><BR>As you can see, we\u2019ve selected the smiley face. When we do so, the character code for the smiley face is listed in the <B>Character code<\/B> box. Now that we know the font we want to use (Wingdings) and the character code for our symbol (74), we\u2019re ready to write a script that inserts the smiley face into a Word document:<\/P><PRE class=\"codeSample\">Set objWord = CreateObject(&#8220;Word.Application&#8221;)\nobjWord.Visible = True\nSet objDoc = objWord.Documents.Add()\nSet objSelection = objWord.Selection<\/p>\n<p>objSelection.InsertSymbol 74, &#8220;Wingdings&#8221;\n<\/PRE>\n<P>We told you the code was trivial. We begin by creating an instance of the <B>Word.Application<\/B> object, and then set the <B>Visible<\/B> property to True. We call the <B>Add()<\/B> method to create a new document, then create an instance of the Word <B>Selection<\/B> object.<\/P>\n<P>At that point all we need is one line of code in order to insert the smiley face symbol:<\/P><PRE class=\"codeSample\">objSelection.InsertSymbol 74, &#8220;Wingdings&#8221;\n<\/PRE>\n<P>That\u2019s it: we call the <B>InsertSymbol<\/B> method followed by the desired character code and the desired font. Run the script, and you should see a smiley face in your document. (It <I>is<\/I> a miracle, isn\u2019t it?)<\/P>\n<P>If you like using symbols it might be worth your while to create a catalog of symbols and their character codes. Here\u2019s a script that creates a Word document containing all the symbols and their character codes found in the Wingdings font (character codes 32 through 255). You can easily modify the script to give yourself a catalog of symbols for Wingdings2, Wingdings3, Webdings, Bookdings, and any other ding-dang font you want.<\/P>\n<P>Here\u2019s the code:<\/P><PRE class=\"codeSample\">Set objWord = CreateObject(&#8220;Word.Application&#8221;)\nobjWord.Visible = True\nSet objDoc = objWord.Documents.Add()\nSet objSelection = objWord.Selection<\/p>\n<p>For i = 32 to 255\n    objSelection.TypeText i &amp; &#8221; &#8212; &#8221;\n    objSelection.InsertSymbol i, &#8220;Wingdings&#8221;\n    objSelection.TypeParagraph()\nNext\n<\/PRE>\n<P>And here\u2019s what the resulting document looks like:<\/P><IMG height=\"458\" alt=\"Microsoft Word Symbols\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/qanda\/symbol-catalog.jpg\" width=\"329\" border=\"0\"> \n<P><BR>It\u2019s not quite the IKEA catalog, but it\u2019s close.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I insert a Wingding symbol into a Word document?&#8212; RC Hey, RC. In case you\u2019re wondering, there were two reasons why we decided to answer your question. First, we just liked the phrase insert a Wingding symbol. (No, we don\u2019t know why we liked it, we just did.) Second &#8211; [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[84,49,3,5],"class_list":["post-69253","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-microsoft-word","tag-office","tag-scripting-guy","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I insert a Wingding symbol into a Word document?&#8212; RC Hey, RC. In case you\u2019re wondering, there were two reasons why we decided to answer your question. First, we just liked the phrase insert a Wingding symbol. (No, we don\u2019t know why we liked it, we just did.) Second &#8211; [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=69253"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69253\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=69253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=69253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=69253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}