Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default The application SendKeys


Hi everybody,

My question is about using the application SendKeys with IF inside VBA,
I have a table contains twenty rows and five columns (File Attached),
what I want is that when any of the twenty cells in column "C" is not
blank, Then: By using the application SendKeys, the current date should
be inserted in the opposite cell in column "D".

I have created a code for that purpose, but it did not work properly,
so I wish I could find the answer in this wonderful site.

And this is the code I have created:

PRIVATE SUB WORKSHEET_CHANGE(BYVAL TARGET AS RANGE)
IF RANGE("C" & TARGET.ROW).VALUE < "" THEN
RANGE("D" & TARGET.ROW).VALUE = APPLICATION.SENDKEYS("^;")
EXIT SUB
END IF
END SUB


+-------------------------------------------------------------------+
|Filename: SendKeys.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3695 |
+-------------------------------------------------------------------+

--
Jim333
------------------------------------------------------------------------
Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186
View this thread: http://www.excelforum.com/showthread...hreadid=396075

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default The application SendKeys

First: Application.SendKeys does not give you a value you can assign to a
range, as you are trying to do; instead you would need to make the desired
cell the active cell and then use SendKeys to type the string "^;" into it,
but...

Next point: it is not necessary or even advisable to use SendKeys for this;
just get today's date with the Date() function:
IF RANGE("C" & TARGET.ROW).VALUE < "" THEN
RANGE("D" & TARGET.ROW).VALUE = DATE()
--
- K Dales


"Jim333" wrote:


Hi everybody,

My question is about using the application SendKeys with IF inside VBA,
I have a table contains twenty rows and five columns (File Attached),
what I want is that when any of the twenty cells in column "C" is not
blank, Then: By using the application SendKeys, the current date should
be inserted in the opposite cell in column "D".

I have created a code for that purpose, but it did not work properly,
so I wish I could find the answer in this wonderful site.

And this is the code I have created:

PRIVATE SUB WORKSHEET_CHANGE(BYVAL TARGET AS RANGE)
IF RANGE("C" & TARGET.ROW).VALUE < "" THEN
RANGE("D" & TARGET.ROW).VALUE = APPLICATION.SENDKEYS("^;")
EXIT SUB
END IF
END SUB


+-------------------------------------------------------------------+
|Filename: SendKeys.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3695 |
+-------------------------------------------------------------------+

--
Jim333
------------------------------------------------------------------------
Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186
View this thread: http://www.excelforum.com/showthread...hreadid=396075


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default The application SendKeys


Hi,

Thank you for your reply, but the code you delivered is not what I want
excalty. The date updates daily while I want it to stay as it was
inserted at the first time and that is why I asked to insert it by
using SendKyes Application.

Do you have another way???


--
Jim333
------------------------------------------------------------------------
Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186
View this thread: http://www.excelforum.com/showthread...hreadid=396075

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.SendKeys "%{down}" damorrison Excel Discussion (Misc queries) 3 June 3rd 06 09:09 PM
SendKeys and Application.ScreenUpdating Michael Malinsky[_2_] Excel Programming 3 March 23rd 05 10:40 PM
Application.SendKeys won't work with Remote Desktop???? WildIrish Excel Programming 1 March 10th 05 02:48 PM
SendKeys to a remote server application green78[_5_] Excel Programming 0 July 28th 04 08:19 PM
Application.sendkeys Adrie Rahanra Excel Programming 1 October 15th 03 04:29 PM


All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"