To querendo criar uma pasta para cada consulta com o mesmo tipo de região, as pastas são geradas porem com o erro:
Tipos incopativeis
Private Sub exportarConsolidado()
Dim xlApp As Excel.Application
Dim xlBk As Excel.Workbook
Dim xlSht As Excel.Worksheet
Dim Str As String
Dim dbRst As Recordset
Dim db As Database
Set db = CurrentDb
SQLStr = "SELECT *FROM tb_consolidado"
Set dbRst = db.OpenRecordset(SQLStr)
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
fcurrentdbdir = Left(strDBPath, InStr(strDBPath, strDBFile) - 1)
Dim diretorio As String
Do While dbRst.RecordCount > 0
diretorio = fcurrentdbdir + dbRst!regional
If Len(Dir(CInt(diretorio), vbDirectory)) > 0 Then
'existe
Else
MkDir (fcurrentdbdir + dbRst!regional)
End If
dbRst.MoveNext
Loop
dbRst.Close
db.Close
Tipos incopativeis
Private Sub exportarConsolidado()
Dim xlApp As Excel.Application
Dim xlBk As Excel.Workbook
Dim xlSht As Excel.Worksheet
Dim Str As String
Dim dbRst As Recordset
Dim db As Database
Set db = CurrentDb
SQLStr = "SELECT *FROM tb_consolidado"
Set dbRst = db.OpenRecordset(SQLStr)
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
fcurrentdbdir = Left(strDBPath, InStr(strDBPath, strDBFile) - 1)
Dim diretorio As String
Do While dbRst.RecordCount > 0
diretorio = fcurrentdbdir + dbRst!regional
If Len(Dir(CInt(diretorio), vbDirectory)) > 0 Then
'existe
Else
MkDir (fcurrentdbdir + dbRst!regional)
End If
dbRst.MoveNext
Loop
dbRst.Close
db.Close