View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default SENDKEYS and brackets

Thanks!!
--
Gary''s Student - gsnu200813


"Jim Rech" wrote:

This is how you send a bracket:

Application.SendKeys "{{}"

--
Jim
"Gary''s Student" wrote in message
...
Your question is a poster child for why people don't like SendKeys.

Brackets and braces {}[]

are tough to "send"

For example:

Sub sendbrackets()
Dim s As String
s = Chr(65)
Cells(1, 1).Select
Application.SendKeys "{F2}"
Application.SendKeys s
Application.SendKeys "{ENTER}"
DoEvents
End Sub

will send an upper case A, but:

Sub sendbrackets()
Dim s As String
s = Chr(123)
Cells(1, 1).Select
Application.SendKeys "{F2}"
Application.SendKeys s
Application.SendKeys "{ENTER}"
DoEvents
End Sub

fails totallly!
--
Gary''s Student - gsnu200813


"Zakynthos" wrote:

I'm using sendkeys (yes, I know not always reliable...) to send data to a
program which admits brackets of any description in headings and names
and
when typed or copied from elsewhere and pasted into a data field will be
readily accepted.

However, when exactly the same data is sent via sendkeys all is exported
but
the brackets are removed.

Why is this? Can I do anything to overrise this and input them into a
data
field?

Many thanks.