'In un modulo Base copiare queste dichiarazioni
Public Declare Function CreateDirectory Lib "kernel32" _ Alias "CreateDirectoryA" (ByVal lpPathname _ As String, lpSecurityAttributes _ As SECURITY_ATTRIBUTES) As Long Type SECURITY_ATTRIBUTES nLength As Long lpSecurityDescriptor As Variant bInheritHandle As Boolean End Type 'Includere un controllo CommonDialog Public Sub OpenLog() Dim LogFile as Integer On Error Goto exit1 OpenLog.Flags = cdlOFNHideReadOnly Or cdlOFNExplorer OpenLog.CancelError = True OpenLog.FileName = "C:\JetLog\JET_LOG.log" temp = OpenLog.FileName Ret = Len(Dir$(temp)) LogFile = FreeFile 'log file. Open temp For Binary Access Write As LogFile If Err Then Exit Sub Else Seek LogFile, LOF(LogFile) + 1 End If Exit Sub exit1: ' Folder non trovato, e creato MsgBox "Messaggio............. " & _ vbCrLf , vbExclamation,"Messaggio" CreateDirX ("C:\JetLog") OpenLog_Click End Sub Private Function CreateDirX(lpPathname As String) As Long Dim FYL As Long Dim DirC As SECURITY_ATTRIBUTES FYL = CreateDirectory(lpPathname, DirC) End Function |