Click to See Complete Forum and Search --> : Help with two things....


masterincubus
August 24th, 2001, 04:29 PM
I have a very small program that opens up internet explorer (here it is):

Private Sub Form_Load()
Page$ = "d:\myfile.html"
ShellX = Shell("explorer.exe " + Page$)
End Sub

There are two things I would like to do with thism but I have no clue how to do it.

1) I am using Form_OnLoad which automatically launches IE once the program is activated. The problem, however, is the form actually pops up too. I would like the program to just run and have IE start but do not have the form from my program to show up.

2) This program will be located on a CD Rom and I want it to open a .html file that will be on this CD Rom. The problem, however, is that I cannot hard code the pathway for the CD rom because the CD Rom will be different from machine to machine.

How can I set Page$ = "d:\myfile.html" so that it will open myfile no matter what drive it is on?

Can someone please help? I have no clue how to do either of these.

Thanks,
Master Incubus

John G Duffy
August 24th, 2001, 06:29 PM
'1). A simple END statement after your Shell 'command will terminate your program like so
'
private Sub Form_Load()
Page$ = "d:\myfile.html"
ShellX = Shell("explorer.exe " + Page$)
END ' Terminate this program
End Sub

'2). IF you use the App.Path statement then 'whatever location your App is running is used.
'If your program is running on "F:\" using
App.Path will like so
'
Page$ = App.Path & "MyFile.htm"
'
will produce results that look like
'
Page$ = "F:\MyFile.htm"
'
If your program is running from a directory other than the root directory,
then App.Path will show something like this. if your app is running on "D:\MyPath" then
App.Path would show "D:\MyPath".
IN this case you would need to add the backslash to your Page$ assignement like this
'
Page$ = App.Path & "\MyFile.htm"
'
this will produce somwthing like this
'
Page$ = "D:\MyPath\MyFile.htm"




John G

forty7
August 24th, 2001, 06:50 PM
don't put your code on a form if you don't want a the form to show.

i would:

create a standard module with a sub main()
put your code in main
remove the form from the project
set main as the startup object (project properties, general tab)

also, if you put myfile.html in the same folder as myapp.exe you don't have to specify a path just do Page$="myfile.html"





thanx/good luck,
adam

masterincubus
August 25th, 2001, 06:54 PM
Hi guys,

Thanks for the help, I will give your suggestions a try and let you know how it goes.

Thanks again,
MI