I am working on a script that generates a MS-project plan from inside of excel. All is working fine but I have trouble setting the header and footer. It looks like I need to identify the view name, but I constantly get a runtime error 1101 or some other errors.
I am working on a danish version of MS-project (Side=Page, Sider=Pages) and according to the title of the pagesetup menu my default view is "Gantt-diagram". Also tried with "Gantt Chart" without luck.
Dim pjapp As Object
Dim newproj As Object
Set pjapp = CreateObject("MSProject.application")
pjapp.Visible = True
Set newproj = pjapp.Projects.Add
Set ActiveProject = newproj
' here I want to remove the legend (does not work)
pjapp.FilePageSetupLegendEx Name:="Gantt-diagram", LegendOn:=pjNoLegend
' here I want to set the footer
pjapp.FilePageSetupFooter Alignment:=pjRight
pjapp.FilePageSetupFooter Text:="&[Side] of &[Sider] just some text here"
' setting page to A3 format - this somehow works
pjapp.FilePageSetupPage PaperSize:=8
' here I want to setup the header (does not work)
pjapp.FilePageSetupHeader Name:="Gantt-diagram", Alignment:=pjRight, Text:="My header"