Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Publisher File to JPEG

Status
Not open for further replies.

Swi

Programmer
Feb 4, 2002
1,963
US
I know you can manually do this conversion in publisher but is there any way to expose this function in VB? A point in the right direction would be helpful. Thanks.

Swi
 
I have tried the following code but an getting the following error:

[red]Method 'SaveAsPicture' of object 'Page' failed[/red]

Code:
Private Sub Command1_Click()
Dim oPubApp As New Publisher.Application
With oPubApp
    .Open "c:\Publication1.pub"
    .ActiveDocument.Pages(1).SaveAsPicture "c:\Publication1.jpeg", pbPictureResolutionCommercialPrint_300dpi
    .ActiveDocument.Close
    .Quit
End With
Set oPubApp = Nothing
MsgBox "Save Complete!", vbInformation
End Sub

Any ideas? Thanks.

Swi
 
Got it.

Code:
Private Sub Command1_Click()
Dim oPubApp As New Publisher.Application
With oPubApp
    .ActiveWindow.Visible = False
    .Open "c:\Publication1.pub", True, False, pbDoNotSaveChanges
    .ActiveDocument.Pages(1).SaveAsPicture "c:\Publication1.[b][blue]jpg[/blue][/b]", pbPictureResolutionCommercialPrint_300dpi
    .ActiveDocument.Close
    .Quit
End With
Set oPubApp = Nothing
MsgBox "Save Complete!", vbInformation
End Sub

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top