{"id":4213,"date":"2014-03-30T09:19:33","date_gmt":"2014-03-30T09:19:33","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/linebreak-in-contentcontrol-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:19:33","modified_gmt":"2014-03-30T09:19:33","slug":"linebreak-in-contentcontrol-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/linebreak-in-contentcontrol-collection-of-common-programming-errors\/","title":{"rendered":"Linebreak in ContentControl-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn Hey,I do have a big problem concerning linebreaks within Plaintext- and Richtext-ContentControls.I want to put two ContentControls right behind each other. No space or linebreak in between. (&#8220;Field1&#8243;&#8221;Field2&#8221;)Then I want to add the following text to one of two controls:<\/p>\n<p>ActiveDocument.SelectContentControlsByTitle(&#8220;VI_Footer2&#8221;).Item(1).Range.Text = &#8220;Hello&#8221; &amp; vbCrLf &amp; &#8220;World&#8221;<\/p>\n<p>My Problem is, using Plaintext-ContentControls (Propertie for Linebreak is set to true), the Hello is within the ContentControl &#8220;VI_Footer2&#8221;, the String &#8220;World&#8221; is in the next line outside of the ContentControl!!! The ContentControls only behave correctly, if I put a linebreak between the two ContentControls. Then the &#8220;Hello linebreak World&#8221; is within the ContentControl&#8230;Using two Richtext-ContentControls placed right behind each other, it doesn&#8217;t work eather! I get the error message &#8220;Runtime error 5844 &#8211; One of the values passed to this method or property is incorrect.&#8221;Here too, if I put a linebreak between the two ContentControls, everthing works fine.I made an example to understand my problem. You can find it here -&gt;<\/p>\n<p>http:\/\/www.laundsch.de\/downs\/LinebreakProblem.docm<\/p>\n<p>Has anyone experienced this problem too? Does anybody know a solution or workaround how to fix this problem!I would appreciate every advice!GreetzMax<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn1 I found a solution to my problem:<\/p>\n<p>using &#8220;<\/p>\n<p>Chr(11)&#8221; instead of &#8220;vbCrLf&#8221; fixes my problem.<br \/>\nChr(11) is equal to &#8220;Shift + Return&#8221;.<\/p>\n<p>Using &#8220;<\/p>\n<p>Chr(11)&#8221; works with Plaintext as well as Richtext ContentControls.Maybe this answer helps out some other people too. I couldn&#8217;t find this anywhere in documentation.Greetz Max<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn2 Yup that worked for me too. \u00a0Thanks for documenting your problem and your solution!<\/p>\n<p>Regards,<\/p>\n<p>Stephen Study<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>msdn Hey,I do have a big problem concerning linebreaks within Plaintext- and Richtext-ContentControls.I want to put two ContentControls right behind each other. No space or linebreak in between. (&#8220;Field1&#8243;&#8221;Field2&#8221;)Then I want to add the following text to one of two controls: ActiveDocument.SelectContentControlsByTitle(&#8220;VI_Footer2&#8221;).Item(1).Range.Text = &#8220;Hello&#8221; &amp; vbCrLf &amp; &#8220;World&#8221; My Problem is, using Plaintext-ContentControls (Propertie for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4213","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4213"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4213\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}