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

Simple Code Question

Status
Not open for further replies.

ITAMike

IS-IT--Management
Jul 23, 2003
15
US
I apologize in advance for I am not a programmer. I have a button on a web page and need the code to run a file just like a link. Let's say the file is located at if I view code on the button what do I put between

Private Sub Button1_Click()
??
End Sub

Thanks
 
I always use the ShellExecute command. i.e.
Code:
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 SW_SHOWNORMAL = 1

Private Sub Button1_Click()
ShellExecute Me.hwnd, vbNullString, "[URL unfurl="true"]http://www.tek-tips.com\myfile.txt",[/URL] vbNullString, "C:\", SW_SHOWNORMAL
End Sub

However you can just use the shell command using IE. e.g
Code:
Private Sub Button1_Click()
Dim myShell
myShell = Shell("C:\Program Files\Internet Explorer\iexplore.exe [URL unfurl="true"]http://www.tek-tips.com/myfile.txt",[/URL] vbMaximizedFocus)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top