Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

control another application from vba

Status
Not open for further replies.

Chacanger

Programmer
Feb 22, 2011
7
0
0
Hi

I'm working on a monthly report system that needs to obtain informtion from a program created in vb98. I have the names of the buttons and controls but I don't know how I can click the buttns type the info in the text boxes and copy data from the system to a spreadsheet. Is it best to use the mouse automation features were you can assign where the mouse goes or is it posibe to use the control names to press btons like you can with interenet explorer?

Sub ImportData()

'Click "btnName"
'Type info into "textbox1"
'Click "btnOK"
'Copy a string of text froma textbox.

'This bit just goes into the spreadshee and paste into the _ correct columns etc.
End Sub

If that isn't possible does anyone know how to get the mouse to move ,highlight text, then copy it?

PS I can't use any additional software to help automate this so need to do it with what info I have.

Any help would be much appriciated.

Thanks

Chacanger
 

a program created in vb98
I am not familiar with vb98, is it VB 6? VB.NET? Actually, it does not matter.

Do you have access to the original program's code? Can you modify it and create an EXE out of it? (Since you know the names of the controls in this program)

Have fun.

---- Andy
 



Hi,

"informtion from a program created in vb98"

Your "program created in vb98" obtains imformation from something. Either it's data embedded in the program or data it acquires from a file or database, along with the user response.

Do you know which?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hmm, looks like it probably comes from a database. I suppose if I just get the mouse to highlight the text and copy it, it could be just as effective. I wolud be able to apply a...

Private Declare Sub BlockInput Lib "USER32.dll" (ByVal fBlockIt As Long)

...To prevent someone moving the mouse and interupting it so that it dosen't go horribly wrong. The only trouble is if I open the program and get the mouse to highlight some text, does anyone know how to copy a string from another program?

Many Thanks

Chacanger
 


You can probably query the database directly from Excel, without reference to the program in question.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks for the reply

I don't think it actually shows anywere the database is, so I can't take the info from there, Another programer who used to work on the system managed to get data from it for a similar project but he's left since, so I can't ask him anymore. I think it would most probably need to be done some other way with the mouse.

Thanks again

Chacanger
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top