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 Form_Load() ShellExecute Me.hwnd, vbNullString, \"notepad.exe\", vbNullString, \"C:\\\", SW_SHOWNORMAL End Sub
\'----------------------------------- Form1 ----------------------------------- \'Tilføje 2 CommandButton på Formel (eks. Form1) og insæt denne koden \'----------------------------------------------------------------------------- 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
Public Function RunCommand(cmd As String) \'ShellExecute Function ShellExecute Me.hwnd, vbNullString, cmd, vbNullString, \"\", 1 End Function
Private Sub Command1_Click() \'CommandButton1 RunCommand \"C:\\\" \'åbner C:\\ i et vindue End Sub
Private Sub Command2_Click() \'CommandButton2 RunCommand \"notepad.exe\" \'åbner Notesblok End Sub \'----------------------------------- Form1 -----------------------------------
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.