|
-
Dec 20th, 2005, 09:55 AM
#1
Thread Starter
New Member
Control a software
Hi, i'm very new with visual basic.
Would like to know if it's possible to control a software. For example, open Word, type some words in a document, go to the edition menu, change the font, and then save the document ?
How would it be done ?
-
Dec 20th, 2005, 10:00 AM
#2
Re: Control a software
Welcome to the forums. 
Set a reference to the Microsoft Word Object Library. Run this
VB Code:
Dim objWord As Word.Application
Set objWord = New Word.Application
objWord.Visible = True
objWord.Documents.Add
Type whatever you want to type, do whatever you want to do, then click on the File/Save menu from Word.
-
Dec 20th, 2005, 10:08 AM
#3
Thread Starter
New Member
Re: Control a software
hum,... no. I want my little vb program to 'click on the file/save menu' from word and save the document. I want to know if litteraly I can 'control' a software, as if the mouse was moving all by itself.
-
Dec 20th, 2005, 10:22 AM
#4
Re: Control a software
 Originally Posted by lepetitcrabe
hum,... no. I want my little vb program to 'click on the file/save menu' from word and save the document. I want to know if litteraly I can 'control' a software, as if the mouse was moving all by itself.
you may use Hack's suggestion for opening Word App and then use SendKeys function for Saving the document.
-
Dec 20th, 2005, 10:27 AM
#5
Hyperactive Member
Re: Control a software
There is a way... I made a program that does something like that. It was basically for an automated learning presentaion that shows you literally what to click, where to click and to an extent HOW to click it and the results...
BUT trust me.. it's not that easy... it requires getting the classname, title and handle of the window... enumerating through all the windows... getting the mouse cursor position and setting it... and the toughest of all... making sure the user does not move the mouse cause you will get a little mouse struggle...
SO unless you're an expert in VB then I suggest going for the simple and referencing MSWO Library as Hack said...
If I can still get my hands on the coding I used I'll upload it...
If my post has been helpful, then please rate it accordingly...
If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.
-
Dec 20th, 2005, 10:30 AM
#6
Re: Control a software
Using the reference Hack has given, it is possible to call the Save function.
Unless you really want to 'control' the mouse, but that will be harder.
You'll have to determine the position of the menu first.
I code C#....

-
Dec 20th, 2005, 10:31 AM
#7
Re: Control a software
 Originally Posted by vbcode1980
Using the reference Hack has given, it is possible to call the Save function.
Unless you really want to 'control' the mouse, but that will be harder.
You'll have to determine the position of the menu first.
Exactly!
You can use either a FileSaveAs or a FileSave right from within your code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|