hi, wondering if anybody can help me please
I am completly new to vb6, so any help would be much apprecciated
basically I have wrote several vbscripts that do various things, and i wanted to create a user interface with vb6, just simple command buttons that run the selected script
can somebody help me please?
Page 1 of 1
help with vb (noobie)
#2
Posted 16 January 2004 - 08:10 PM
I currently have:
Private Sub start_Click()
shell ("c:\program files\cv1.vbs")
End Sub
but no luck
Private Sub start_Click()
shell ("c:\program files\cv1.vbs")
End Sub
but no luck
#3
Posted 16 January 2004 - 09:22 PM
Try this:
That should work. If for some weird reason it doesn't, mess around with this:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Const conSwNormal = 1 Private Sub start_Click() ShellExecute hWnd, "open", "C:\Program Files\cv1.vbs", vbNullString, vbNullString, conSwNormal End Sub
That should work. If for some weird reason it doesn't, mess around with this:
Shell ("start C:\Program Files\cv1.vbs")
I don't know if the inclusion of the word "start" or "run" makes a difference.
#4
Posted 17 January 2004 - 08:48 AM
Thankyou very very much, much appreciated
It worked a treat!!!
It worked a treat!!!
#5
Posted 23 January 2004 - 02:35 PM
The easiest way I found is
Shell "explorer c:\program files\cv1.vbs"
Shell "explorer c:\program files\cv1.vbs"
#6
Posted 28 January 2004 - 09:00 PM
A snippet of code that checks for the file you're about to launch. It's helpful in those sort of apps, especially if you deploy to end users.
Now for your button pressing. (Btw. Give items useful three letter prefixes. Command buttons get cmd etc, List boxes get lst, etc etc.)
Public Function FileExists(testFile As String) As Boolean On Error GoTo noExist Dim fn As Long fn = FreeFile Open testFile For Input As #fn Close #fn FileExists = True Exit Function noExist: FileExists = False End Function
Now for your button pressing. (Btw. Give items useful three letter prefixes. Command buttons get cmd etc, List boxes get lst, etc etc.)
Dim Path as String
Private Sub cmdCv1_Click()
Path = LCase$("C:\PROGRAM FILES\CV1.VBS")
If FileExists(Path) = True Then
Call Shell(Path)
Else
MsgBox "cv1.vbs was not found." & vbCrLf & "Loading aborted.", vbCritical, "Unable to load cv1.vbs."
End If
End Sub
#7
Posted 28 January 2004 - 09:22 PM
ok www.experts-exchange.com
should help u a lot.. if not this board..
should help u a lot.. if not this board..
#8
Posted 01 February 2004 - 08:27 PM
Thanks very much you guys, you have all been very helpfull
I have now sorted it!
I have now sorted it!
#9
Posted 02 February 2004 - 03:46 AM
best place to start with n00bie coding is buy a book, specifically on visual basic.. (6 or .Net) what ever u have.. or library, or many places on the net.. www.pscode.com for samples. snippets or tutorials..
Share this topic:
Page 1 of 1



Help
Back to top









