Boa noite!!
Já usou a pesquisa do fórum???
Tente algo........
Option Explicit
Private Const theDrive As String = "C"
Private Const theDriveFormat As String = ":"
Private Const theDir As String = "pastaPDF"
Private Const theDirFormat As String = ""
Public targetpath As String
Sub Part_I_8634()
If testDir = True Then
'Sua Rotina
Exit Sub
Else
MkDir targetpath
End If
theEnd:
' Sua Rotina
Exit Sub
End Sub
Function testDir() As Boolean
testDir = False
targetpath = theDrive
targetpath = targetpath & theDriveFormat
targetpath = targetpath & theDir
targetpath = targetpath & theDirFormat
If Dir(targetpath, vbDirectory) = "" Then testDir = False _
Else
testDir = True
theEnd:
'Sua Rotina
Exit Function
End Function
Ou....
Sub AleVBA()
Dim rspCreate
If Dir("C:pastaPDF", vbDirectory) = "" Then
rspCreate = MsgBox("Diretorio não existe, Você deseja Criar?", vbYesNo)
If rspCreate = vbYes Then
MkDir "C:pastaPDF"
End If
End If
End Sub
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 22/06/2013 3:50 pm