Moderatori: Anthony47, Flash30005
'PARAMETRI DA PERSONALIZZARE
myZipProg = """C:\Program Files (x86)\7-Zip\7z.exe"""
myZipFile = """C:\Users\UTENTE\Documents\NomeFile.zip"""
myExtrDir = "C:\PROVA\7-zip\"
myZipPassw = "12345678"
'Fine parametri
'
Respp = Shell(myZipProg & " e " & myZipFile & " -o" & myExtrDir & " -p" & myZipPassw, 1)
myStart = Timer
Do
DoEvents
If Timer > myStart + 10 Or Timer < myStart Then Exit Do
Loop
RetVal = Shell("C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe " & PathNName, 1)
Private Sub Workbook_Open()
Dim WinRarPath As String 'WinRar.exe location
Dim RarIt As String 'Command line instruction
Dim SourceDir As String 'The source directory
Dim SourceRarFile As String 'The source file
Dim Source As String 'The combined Rar from path(s)(FROM)
Dim Dest As String 'The combined unRar to path (TO)
WinRarPath = "C:\Programmi\WinRar\"
If Dir(WinRarPath, vbDirectory) = "" Then
MsgBox "WinRar is not installed in the default directory." _
& Chr$(13) & "Archiving of files will not be possible."
Exit Sub
End If
Start = Timer
SourceDir = "C:\Gioco"
SourceRarFile = "Talo.Rar"
Source = SourceDir & "\" & SourceRarFile
If InStr(1, Source, " ", vbTextCompare) <> 0 Then Source = Chr(34) & Source & Chr(34)
Dest = "C:\Gioco\"
If Dir(Dest, vbDirectory) = "" Then MkDir Dest
If InStr(1, Dest, " ", vbTextCompare) <> 0 Then Dest = Chr(34) & Dest & Chr(34)
'
RarIt = Shell _
(WinRarPath & "Rar.exe e -pmajor" & TuaPassword & " " & Source & " " & Dest)
Do
DoEvents
If Timer > myStart + 1 Or Timer < myStart Then Exit Do
Loop
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Kill "C:\Gioco\*.pdf" '<<< Cancella tutti i file PDF presenti in quella directory
End Sub
Public MyMacro
MyMacro = 1
MyMacro = 0
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MyMacro = 1 Then
Cancel = True
Else
Kill "C:\Gioco\*.pdf" '<<< Cancella tutti i file PDF presenti in quella directory
End If
End Sub
Respp = Shell(myZipProg & " e " & myZipFile & " -o" & myExtrDir & " -p" & myZipPassw, 1)
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Resp2 = Shell("taskkill /PID " & Respp & " /F")
'Attendi 2 sec per il completamento del taskkill
myStart = Timer '<**>
Do
DoEvents
If Timer > myStart + 2 Or Timer < myStart Then Exit Do
Loop
Kill "C:\Gioco\*.pdf" '<<< Cancella tutti i file PDF presenti in quella directory
End Sub
Public Respp As Long
Private Sub Workbook_Open()
Dim WinRarPath As String 'WinRar.exe location
Dim RarIt As String 'Command line instruction
Dim SourceDir As String 'The source directory
Dim SourceRarFile As String 'The source file
Dim Source As String 'The combined Rar from path(s)(FROM)
Dim Dest As String 'The combined unRar to path (TO)
WinRarPath = "C:\Programmi\WinRar\"
If Dir(WinRarPath, vbDirectory) = "" Then
MsgBox "WinRar is not installed in the default directory." _
& Chr$(13) & "Archiving of files will not be possible."
Exit Sub
End If
SourceDir = "D:"
SourceRarFile = "ARCHIVIO CARICHI e SCARICHI CM 1-2-3 ANNO 2011.Rar"
Source = SourceDir & "\" & SourceRarFile
If InStr(1, Source, " ", vbTextCompare) <> 0 Then Source = Chr(34) & Source & Chr(34)
Dest = "C:\Servito"
If Dir(Dest, vbDirectory) = "" Then MkDir Dest
If InStr(1, Dest, " ", vbTextCompare) <> 0 Then Dest = Chr(34) & Dest & Chr(34)
RarIt = Shell _
(WinRarPath & "Rar.exe e -pmarilena" & TuaPassword & " " & Source & " " & Dest)
Start = Timer
Do
DoEvents
If Timer > myStart + 10 Or Timer < myStart Then Exit Do
Loop
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Cellss(5, 3) = "carico1" Then
Range("G2") = "Documento visionabile"
Foglio1.Hyperlinks.Add Anchor:=Range("G2"), Address:="C:/Servito/1 CM 1 2 3 di carico.pdf"
ElseIf Cells(5, 3) = "carico22" Then
Range("G2") = "Documento visionabile"
Foglio1.Hyperlinks.Add Anchor:=Range("G2"), Address:="C:/Servito/22 CM 1 2 3 di carico.pdf"
ElseIf Cells(5, 3) = "carico222" Then
Range("G2") = "Documento visionabile"
Foglio1.Hyperlinks.Add Anchor:=Range("G2"), Address:="C:/Servito/222 CM 1 2 3 di carico.pdf"
Else
Hyperlinks.Delete
Range("G2") = "DOCUMENTO NON ELABORATO"
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Cells(25, 3) = "scarico1" Then
Range("G16") = "Documento visionabile"
Foglio1.Hyperlinks.Add Anchor:=Range("G16"), Address:="C:/Servito/1 CM 1 2 3 di scarico.pdf"
ElseIf Cells(25, 3) = "scarico2" Then
Range("G16") = "Documento visionabile"
Foglio1.Hyperlinks.Add Anchor:=Range("G16"), Address:="C:/Servito/2 CM 1 2 3 di scarico.pdf"
ElseIf Cells(25, 3) = "scarico3" Then
Range("G16") = "Documento visionabile"
Foglio1.Hyperlinks.Add Anchor:=Range("G16"), Address:="C:/Servito/3 CM 1 2 3 di scarico.pdf"
Else
Foglio2.Hyperlinks.Delete
Range("G16") = "DOCUMENTO NON ELABORATO"
End If
End Sub
Private Sub Workbook_Open()
Dim WinRarPath As String 'WinRar.exe location
Dim RarIt As String 'Command line instruction
Dim SourceDir As String 'The source directory
Dim SourceRarFile As String 'The source file
Dim Source As String 'The combined Rar from path(s)(FROM)
Dim Dest As String 'The combined unRar to path (TO)
WinRarPath = "C:\Programmi\WinRar\"
If Dir(WinRarPath, vbDirectory) = "" Then
MsgBox "WinRar is not installed in the default directory." _
& Chr$(13) & "Archiving of files will not be possible."
Exit Sub
End If
SourceDir = "D:"
SourceRarFile = "ARCHIVIO CARICHI e SCARICHI CM 1-2-3 ANNO 2011.Rar"
Source = SourceDir & "\" & SourceRarFile
If InStr(1, Source, " ", vbTextCompare) <> 0 Then Source = Chr(34) & Source & Chr(34)
Dest = "C:\Servito"
If Dir(Dest, vbDirectory) = "" Then MkDir Dest
If InStr(1, Dest, " ", vbTextCompare) <> 0 Then Dest = Chr(34) & Dest & Chr(34)
RarIt = Shell _
(WinRarPath & "Rar.exe e -pmarilena" & TuaPassword & " " & Source & " " & Dest)
Start = Timer
Do
DoEvents
If Timer > myStart + 10 Or Timer < myStart Then Exit Do
Loop
End Sub
________________________________________________________________________________________________________________
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Resp2 = Shell("taskkill /PID " & Respp & " /F")
'Attendi 2 sec per il completamento del taskkill
Do
DoEvents
If Timer > myStart + 2 Or Timer < myStart Then Exit Do
Loop
Kill "C:\Servito\*.pdf" '<<< Cancella tutti i file PDF presenti in quella directory
End Sub
Do
DoEvents
If Timer > myStart + 2 Or Timer < myStart Then Exit Do
Loop
myStart = Timer
Do
DoEvents
If Timer > myStart + 2 Or Timer < myStart Then Exit Do
Loop
Private RarIt as Long '** Rigorosamente in testa al modulo
Private Sub Workbook_Open()
Dim WinRarPath As String 'WinRar.exe location
'Dim RarIt As String 'Command line instruction '**
Dim SourceDir As String 'The source directory
Dim SourceRarFile As String 'The source file
Dim Source As String 'The combined Rar from path(s)(FROM)
Dim Dest As String 'The combined unRar to path (TO)
WinRarPath = "C:\Programmi\WinRar\"
If Dir(WinRarPath, vbDirectory) = "" Then
MsgBox "WinRar is not installed in the default directory." _
& Chr$(13) & "Archiving of files will not be possible."
Exit Sub
End If
SourceDir = "D:"
SourceRarFile = "ARCHIVIO CARICHI e SCARICHI CM 1-2-3 ANNO 2011.Rar"
Source = SourceDir & "\" & SourceRarFile
If InStr(1, Source, " ", vbTextCompare) <> 0 Then Source = Chr(34) & Source & Chr(34)
Dest = "C:\Servito"
If Dir(Dest, vbDirectory) = "" Then MkDir Dest
If InStr(1, Dest, " ", vbTextCompare) <> 0 Then Dest = Chr(34) & Dest & Chr(34)
RarIt = Shell _
(WinRarPath & "Rar.exe e -pmarilena" & TuaPassword & " " & Source & " " & Dest)
Start = Timer
myStart = Timer '**
Do
DoEvents
If Timer > myStart + 10 Or Timer < myStart Then Exit Do
Loop
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Resp2 = Shell("taskkill /PID " & RarIt & " /F") '**
'Attendi 2 sec per il completamento del taskkill
MyStart = Timer '**
Do
DoEvents
If Timer > myStart + 2 Or Timer < myStart Then Exit Do
Loop
Kill "C:\Servito\*.pdf" '<<< Cancella tutti i file PDF presenti in quella directory
End Sub
Public Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Sub PlayWavFile(WavFileName As String, Wait As Boolean)
If Dir(WavFileName) = "" Then Exit Sub ' nessun file da riprodurre, esce
If Wait Then ' sincrono: riproduce il suono per intero prima di continuare
sndPlaySound WavFileName, 0
Else ' asincrono: riproduce il suono indipendentemente dall'esecuzione del resto del codice
sndPlaySound WavFileName, 1
End If
End Sub
Sub TestPlay()
PlayWavFile "D:\Tensione_Evolutiva.wav", False
MsgBox "Ricerca dei documenti in atto..."
PlayWavFile "D:\Tensione_Evolutiva.wav", True
MsgBox "Riceca documenti completata ..."
End Sub
Private Sub Workbook_Open()
ActiveSheet.Shapes("Object 18").Select
Selection.Verb Verb:=xlPrimary
End Sub
Torna a Applicazioni Office Windows
Macro modifica date scelta periodo Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 11 |
Inserire dati filtrati da 2 file ad un terzo file Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 14 |
Supporto per sviluppo macro VBA Ordinare per data Autore: Carletto Ribolla |
Forum: Applicazioni Office Windows Risposte: 3 |
Visitano il forum: Nessuno e 14 ospiti