P
Paul Otto
With the following code I am trying to add new pages to a new document. But
all attempts fail:
Private Sub cmdSetupPubDoc_Click()
Dim sMsg As String
Dim lngPageID As Long
Dim story01 As Publisher.Story
Dim page01 As Publisher.Page
Dim page02 As Publisher.Page
Dim page03 As Publisher.Page
Dim page04 As Publisher.Page
Dim textframe01 As Publisher.TextFrame
Dim shpTextBox1 As Publisher.Shape
Dim shpTextBox2 As Publisher.Shape
On Error GoTo eh
Set oApp = New Publisher.application
Set oDoc = oApp.NewDocument
oApp.ActiveWindow.Visible = True
With oDoc
.SaveAs "XYZ1.pub", pbFilePublication, True
.LayoutGuides.MarginBottom = 60
.LayoutGuides.MarginTop = 30
.LayoutGuides.MarginLeft = 30
.LayoutGuides.MarginRight = 30
.LayoutGuides.Columns = 3
'.LayoutGuides.Rows = 9
.ViewTwoPageSpread = True
.ActiveView.Zoom = pbZoomWholePage
' the following line does not work:
' .Pages.Add 1, 1
End With
Set page01 = oApp.ActiveDocument.Pages(1)
' the following line does not work:
' oApp.ActiveDocument.Pages.Add 1, 2
' the following line does not work, either:
lngPageID = oApp.ActiveDocument.Pages.Add(Count:=1, After:=1).PageID
...
...
ende:
exit sub
eh:
msgbox err.description
resume ende
end sub
Can someone help me, please?
Thanks in advance.
Paul
all attempts fail:
Private Sub cmdSetupPubDoc_Click()
Dim sMsg As String
Dim lngPageID As Long
Dim story01 As Publisher.Story
Dim page01 As Publisher.Page
Dim page02 As Publisher.Page
Dim page03 As Publisher.Page
Dim page04 As Publisher.Page
Dim textframe01 As Publisher.TextFrame
Dim shpTextBox1 As Publisher.Shape
Dim shpTextBox2 As Publisher.Shape
On Error GoTo eh
Set oApp = New Publisher.application
Set oDoc = oApp.NewDocument
oApp.ActiveWindow.Visible = True
With oDoc
.SaveAs "XYZ1.pub", pbFilePublication, True
.LayoutGuides.MarginBottom = 60
.LayoutGuides.MarginTop = 30
.LayoutGuides.MarginLeft = 30
.LayoutGuides.MarginRight = 30
.LayoutGuides.Columns = 3
'.LayoutGuides.Rows = 9
.ViewTwoPageSpread = True
.ActiveView.Zoom = pbZoomWholePage
' the following line does not work:
' .Pages.Add 1, 1
End With
Set page01 = oApp.ActiveDocument.Pages(1)
' the following line does not work:
' oApp.ActiveDocument.Pages.Add 1, 2
' the following line does not work, either:
lngPageID = oApp.ActiveDocument.Pages.Add(Count:=1, After:=1).PageID
...
...
ende:
exit sub
eh:
msgbox err.description
resume ende
end sub
Can someone help me, please?
Thanks in advance.
Paul