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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 .Exe That Runs By Itself

Status
Not open for further replies.

GKatReliable

Programmer
Jul 2, 2002
45
US
I need to change my VB6 program to run in the wee hours of the morning on an unattended machine, probably through task scheduler. I want to know how to re-arrange my VB code. We are taught to create a form, put on a command button and write code behind that to do stuff, then put on another command button on the form to quit. Well, with no user interaction, where in my VB project does the code go so that it just plain runs, then gets out? This is a deal where the mainframe generates a download overnight, then this program pulls that in, reformats it, and stuffs it into an Access database on an internal Web server for our ASP code. Real work kinda stuff. Do you really need a form in VB? It used to be, back in simpler times before all this visual stuff, you just wrote a BAS program and compiled it, and it ran.
 
You don't need a form. Create a Module and add the following:

Sub Main()


End Sub


Then set that Sub as the Startup Object under Project Properties.
 
Remove any forms from your application

Add a standard BAS module.

Make a Sub called Main in the BAS module

Set (Sub Main) the StartUp Objetc in the projects properties menu.

Enable the Unattended Execution checkbox in the properties menus’. This will suppress any unexpected messages that might halt the app.

Write desired code in Sub Main.

Does this help?
 
An electronic High Five goes out to all of you!
Appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top