Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Speaking more generally, you need to perform cleanup and remove not allowed chars from string which is going to be folder name. Once I faced the same trouble in the similar situation - save hundreds of emails from Outlook using Subjects as names. Below are 2 approaches, both use <strong>RegEx</strong>:</p> <ul> <li><p>Create the list of unacceptable chars using the following pattern:</p> <pre><code>RegX_NAChars.Pattern = "[\" &amp; Chr(34) &amp; "\!\@\#\$\%\^\&amp;\*\(\)\=\+\|\[\]\{\}\`\'\;\:\&lt;\&gt;\?\/\,]" </code></pre></li> </ul> <p><code>Chr(34)</code> is double quote, for obvious reasons it's impossible to list it directly. For your particular case you should add to the list so called "new line" chars as well using <code>"[start of pattern]" &amp; "\" &amp; Chr(10) &amp; "\" &amp; Chr(13) &amp; "[rest of pattern]"</code>. The order of chars in pattern does not matter.</p> <ul> <li><p>The opposite approach is declare the list of allowed chars and remove all the rest:</p> <pre><code>RegX_NAChars.Pattern = "[^\w \-.]" </code></pre></li> </ul> <p>The above pattern means all <strong>BUT</strong> latin letters, digits, space, dot and hyphen will be replaced / removed.</p> <p>Both approaches have their own pros and cons, but but I think main reasons are:</p> <ol> <li><strong>Disallowed chars</strong> should be used when the goal is to preserve original string as much as possible.</li> <li><strong>Allowed chars</strong> list should be used when the name is not so important, but saving any file with no errors is the #1 goal.</li> </ol> <p>This is the relevant piece of code for RegEx use:</p> <pre><code> Dim RegX_NAChars As Object Set RegX_NAChars = CreateObject("VBScript.RegExp") RegX_NAChars.Pattern = [**use any of the above**] RegX_NAChars.IgnoreCase = True RegX_NAChars.Global = True ........[**your code**]........ RegX_NAChars.Replace(String_to_Cleanup, "") </code></pre> <p><code>RegX_NAChars.Replace</code> above will replace all matching chars with the defined replacement string. In my case it's <code>""</code> - empty string, which means chars are thrown away. Replace it to anything (of course, these MUST be allowed for folder name chars as well - e.g. use <code>_</code>).</p> <p>Read more about RegEx: <a href="http://www.jose.it-berater.org/scripting/regexp/regular_expression_syntax.htm" rel="nofollow">http://www.jose.it-berater.org/scripting/regexp/regular_expression_syntax.htm</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload