Solved

Problem with Sendkeys

Posted on 2006-06-24
3
210 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

751 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