Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Visual Basic Code

Posted on 2011-02-22
5
Medium Priority
?
232 Views
Last Modified: 2012-08-14
Was trying to figure this out for a while now - but cant at all.
Basically what i want to do is, using Visual Basic:

I want VB to analyze a specific file and, if that file has not been updated for the last 15 minutes, i want the R key to be pressed.

I also have another, similar thing i need to do which i cant figure out:

I want VB to analyze the same as the above file and, if that file has been updated within the last 5 minutes, i want the NUM lock to be toggled on

Sounds simple enough i know, but i, nor my google attempts, can figure it out
much appreciated to anyone who can help
0
Comment
Question by:kakashisharingun
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
darbid73 earned 2000 total points
ID: 34958499
1 if file has not been modified for 15 minutes

If DateDiff("n", FileDateTime("C:\Somefile.txt"), Now) > 15 Then
    MsgBox "Modified more than 15 minutes ago"
End If

Open in new window


You can change this around for Greater than or Less than 15

You could use the Sendkeys to press r

SendKeys "r"

Open in new window


You might find that the num lock is a little harder see here for how Microsoft suggests Toggle Num Lock
0
 
LVL 20

Expert Comment

by:darbid73
ID: 34958509
Also see here for NUM LOCK

FreeVBCode.com
0
 

Author Comment

by:kakashisharingun
ID: 35186981
I thaught i did accept their answer already
0
 

Author Comment

by:kakashisharingun
ID: 35186989
I am attempting to accept his solution now - but it doesn't appear to be letting me...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

879 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