First problem, I can't set the initial folder for the FileSelectFolder method:
Code: Select all
startFold := "X:\68-261•Export, Fiches Concours\11•maquettes"
FileSelectFolder strPath, startFold
If strPath =
{
return
}
msgbox % strPath
Second, I can't find the way to loop in all .pub files.
Here is my VBA macro to help you understand what I'm trying to do:
Code: Select all
Sub allPDF()
Dim strPath As String
Dim strFile As String
Dim pubApp As Publisher.Application
Dim pubDoc As Publisher.Document
strPath = foldPicker() & "\"
If strPath = "False\" Then Exit Sub
xCount = 0
strFile = Dir(strPath & "*.pub")
Do While strFile <> ""
thePath = (strPath & strFile)
theDest = (Left(thePath, (Len(thePath) - 4))) & ".pdf"
Set pubApp = New Publisher.Application
Set pubDoc = pubApp.Open(thePath)
pubApp.ActiveWindow.Visible = False 'execution en arrière-plan
pubDoc.ExportAsFixedFormat pbFixedFormatTypePDF, theDest
pubDoc.Close
xCount = xCount + 1
strFile = Dir
Loop
MsgBox "L'export est terminé. " & xCount & " fichiers ont été créés."
End Sub