[ mirjanagb @ 26.02.2008. 13:55 ] @
koji bi bio kod za startovanje programa iz posebnog foldera? |
[ mirjanagb @ 26.02.2008. 13:55 ] @
[ 3okc @ 26.02.2008. 14:00 ] @
Nisam proverio ali mi se čini da je ovo pokriveno u:
Citat: Links .TextBody = "file://Yourcomputer/YourFolder/Week2.xls" 'If there are spaces use %20 .TextBody = "file://Yourcomputer/YourFolder/Week%202.xls" 'Example for a file on a website .TextBody = "http://www.rondebruin.nl/files/EasyFilter.zip" [ mirjanagb @ 26.02.2008. 14:25 ] @
ne razumem???
ja treba da startujem jedan .exe fajl koji se po zavrsetku posla, sam zatvara .. [ mirjanagb @ 26.02.2008. 14:42 ] @
to bi trebalo nesto sa funkcijom Shell() da bude
[ Jpeca @ 26.02.2008. 15:03 ] @
Sama si dala odgovor. Evo jedan primer
Sub test() ' Specifying 1 as the second argument opens the application in ' normal size and gives it the focus. Dim RetVal RetVal = Shell("C:\Program Files\Windows NT\Pinball\Pinball.Exe", 1) ' Run Pinball Game End Sub [ mirjanagb @ 27.02.2008. 14:04 ] @
otvori on program ali se odmah na pocetku prilikom instaliranja pojavi greska ... i prekine mi radnju ...
mozda prebrzo krene ... postoji li neka mogucnost da uspori makro, dok ovaj program ne zavrsi posao ... koji se pri tom automatski zatvori?? [ Jpeca @ 27.02.2008. 14:50 ] @
Neko moguće rešenje našao sam na adresi http://vb-helper.com/vba_shell_and_wait.html
Code: Option Explicit Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Const SYNCHRONIZE = &H100000 Private Const INFINITE = -1& ' Start the indicated program and wait for it ' to finish, hiding while we wait. Private Sub ShellAndWait(ByVal program_name As String, ByVal window_style As VbAppWinStyle) Dim process_id As Long Dim process_handle As Long ' Start the program. On Error GoTo ShellError process_id = Shell(program_name, window_style) On Error GoTo 0 ' Wait for the program to finish. ' Get the process handle. process_handle = OpenProcess(SYNCHRONIZE, 0, process_id) If process_handle <> 0 Then WaitForSingleObject process_handle, INFINITE CloseHandle process_handle End If Exit Sub ShellError: MsgBox "Error starting task " & _ program_name & vbCrLf & _ Err.Description, vbOKOnly Or vbExclamation, _ "Error" End Sub Sub RunProg() ShellAndWait "C:\Temp\SayHi.exe", vbNormalFocus ' Ovde zadaj putanju i naziv programa MsgBox "Gotovo" End Sub [ mirjanagb @ 29.02.2008. 08:23 ] @
probacu kasnije da isprobam pa cu ti reci jel funkcionise, inace sam napisala makro .. meni je trebao bat file ...
... ne radi ni ovaj makro, mada je isti kao moj, samo sto adresa umesto .exe ide .bat ... problem je znaci bio u bat fajlu ... [Ovu poruku je menjao mirjanagb dana 29.02.2008. u 09:49 GMT+1] Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|