Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with Sendkeys

Posted on 2006-06-24
3
Medium Priority
?
216 Views
Last Modified: 2011-10-03
I have a text box with multiline set to true.
I put multiple lines of text in it

For example:
In Form2.Text1 I have:
Line1
Line2
Line3

Then:


Then I set focus to another text box on a different form and use sendkeys like this:
Form1.Text1.SetFocus
SendKeys Chr(34) & Me.Text1.Text & Chr(34)
"Line1

Line2

Line3"

It's inserting and extra return between each line.
Any body know how I can solve this problem.
I know Sendkeys isn't the best thing to use, but  it does fit with my situation


Thanks!
Cheers!
ahammar

0
Comment
Question by:ahammar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
iHadi earned 2000 total points
ID: 16977915
Hi ahammar
Try the following code:


Dim tmpStr As String
tmpStr = Replace(Text1.Text, vbCrLf, Chr(13))

Text2.SetFocus
SendKeys tmpStr
0
 
LVL 23

Author Comment

by:ahammar
ID: 16978061
Hi iHadi,

Thank you!!  It works great!
The points are all yours

Cheers!
ahammar
0
 
LVL 13

Expert Comment

by:iHadi
ID: 16978107
You're welcome
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question