mass cpnvertion of publisher files to html

  • Thread starter david matraberci via OfficeKB.com
  • Start date
D

david matraberci via OfficeKB.com

Hi,

Ive got more then 1000 separate publisher files (a catalog), and they should be converted into html files. Now, i know how to make the convertion of 1 page, but is there any way to make a mass convertion? Or is the only way by macros? If yes, is there any example i can use?
Thanks

david
 
D

david matraberci via OfficeKB.com

It seems noone helped, so i had to do it myself. Though im working only 3 hours in vb macro, it seems fine what ive done. (Ok im expert in most other programming languages).
So the macro:

Dim indirectory As String
Dim outdirectory As String

Sub massHTMLConvert()
Dim intCount As Integer

indirectory = *here comes the dir where the .pub files are*
outdirectory = *here comes the output dir*

With Application.FileSearch
.Filename = "*.pub"
.LookIn = indirectory
.SearchSubFolders = True
.Execute
For intCount = 1 To .FoundFiles.Count
ConvertPub .FoundFiles(intCount)
Next intCount
End With



End Sub

Sub ConvertPub(fn As String)
Dim objDocument As Document
Dim appPub As New Publisher.Application
Set objDocument = appPub.Open( _
Filename:=fn, ReadOnly:=True, AddToRecentFiles:=False, _
SaveChanges:=pbPromptToSaveChanges)
appPub.ActiveWindow.Visible = True


objDocument.ConvertPublicationType (pbTypeWeb)
objDocument.SaveAs Filename:=outdirectory & "\" & objDocument.Name, _
Format:=pbFileHTMLFiltered

appPub.ActiveWindow.Visible = False
objDocument.Close
Set objDocument = Nothing
Set appPub = Nothing

End Sub


Notes:
-the codes searches in the subfolders as well
-if you want special publication options (like png usage, and such), a WebOption object had to be passed to the appPub object

david
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top