What is the command to run a file from VB?

2006-09-22 2:34 am
I dont need Shell command.. Coz i m tryin to run a vbs file !!!

HELPPP FAST!
更新1:

The Answer was ------------------------------------------------------ Option Explicit 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 Private Sub Command1_Click() Dim strVBSPath As String strVBSPath = "C:\MyVBSscript.vbs" ShellExecute Me.hwnd, vbNullString, strVBSPath, vbNullString, "C:\", 0 End Sub

回答 (4)

2006-09-22 2:55 am
✔ 最佳答案
Your question is not clear enough for me to give you the precise answer. But here, I answer it anyway. I just hope that it's what your looking for:

1) To run a file from VB without using the 'Shell' command, you can use 'ShellExecute'. It's an API command. You can download all download all the API command here: http://allapi.net

2) If you just want to run a project in VB IDE, go to 'Run' menu and select 'Start' or just press the shortcut key, F5.

For free VB source codes, visit: http://smartcoder.awardspace.com


KaBalweg
http://smartcoder.awardspace.com
2006-09-22 9:45 am
WshShell.run
2006-09-22 9:43 am
Read about "shell" command
2006-09-22 9:40 am
I don't excatly get your question, but if you want to run your application jsut press f5 and it should start, depending on what vb you have.

If you want to do a function or something just declare the funtion and then type the function where you want it to be run.

or, if you want your vb application to do something... you can use this

Fileopen(1, "file-location", openmode.output)


收錄日期: 2021-04-28 23:18:56
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20060921183420AAdhbv8

檢視 Wayback Machine 備份