0

I have a program that enters data in pdf's and saves them within a set file. This all works fine until I start saving to files that have parentheses in their names. Example below with code.

I have the following code that is the source of all the error:

Dim SavePDFFldr As String
SavePDFFldr = "S:\Housing & Silencers\Product(s)\(EXF) - Standard Combo Supports\4 - Drawings\Sales Drawing (New)"

With some non-relavant code between.

Application.SendKeys SavePDFFldr

The output is

S:\Housing & Silencers\Products\EXF - Standard Combo Supports\4 - Drawings\Sales Drawing New

... The exact same thing, just missing the parentheses.

How do I make the sendkeys type the much needed parentheses (or use a similar function).

I need to be able to save the directory as that SavePDFFldr and have it entered exactly when I call for it.

Thank you in advance for any/all help.

braX
  • 11,506
  • 5
  • 20
  • 33
JoshL
  • 164
  • 1
  • 12
  • Firstly, why would you need to use `SendKeys` to do this? That's probably the worst solution. – braX Apr 01 '20 at 19:39
  • I'm working within the Save As dialog box and I'm not sure how to set the name to this without it. – JoshL Apr 01 '20 at 19:41
  • Include the rest of your relevant code in your question. Someone (maybe me) will explain how to set the document to an object variable so you can save it that way. – braX Apr 01 '20 at 19:44
  • I would much rather be able to keep this as is, with a solution to be able to make the sendkeys function type in the missing parentheses. If thats possible – JoshL Apr 01 '20 at 20:03
  • It answers the question as to why they are not appearing, but not how to fix it with the way I am using the sendkeys – JoshL Apr 01 '20 at 20:06
  • 1
    Doesn't the link from @braX tell you to enclose the parens in braces e.g. `{(}` and `{)}`? – xidgel Apr 01 '20 at 20:26
  • Yes, if I were actually using the sendkeys function with each bracket but I have a named value above with the parentheses in that. So I'm not using the sendkeys in the same way that this solution would fix – JoshL Apr 01 '20 at 20:38
  • There's only 1 way to use `SendKeys`... perhaps if you included your code in your question........ – braX Apr 01 '20 at 20:45
  • If you look above, the code that I have included is Exactly where the problem is. I set the SavePDFFldr to a value. Then use send keys to type what the value of SavePDFFldr is. No other code is relevant. The other way of using send keys is telling it what to type by putting EACH letter in. This is the way that you are solving. It does not help me. – JoshL Apr 01 '20 at 21:10

0 Answers0