Under Sw 2015 and later, I can't get the VBA Newsheet3 or Newsheet4 instructions to insert a new sheet into a drawing from a VBA macro:
The sheet is indeed created with the specified background but it does not appear. I need to open the drawing in sw, do leaf properties/reload so that it appears.
Note that with the examples of Macros provided in the help it doesn't work either.
Yes, these are custom basemaps, but the templates are available on 1 server and in the settings of the new sheet I specify the right path, by the way NewSheet3 worked very well under sw2014 with the same parameters before the appearance of the areas on the map sheets (configurable in New Sheet4).
on the other hand if I use NewSheet3 (without the Zones) in sw2015 it doesn't work any better. There is a change that I cannot determine.
Maybe someone has recently used newshhet4 successfully, it would be interesting to have his feedback.
In attachment the properties of the inserted sheet (everything seems normal to me) and I checked by getTemplateName the right fdp is well taken into account.
In fact I just found that SW can't reload the FDP when the new sheet is of the same format and orientation as the previous one. When you choose a different format, it works.
I solved my pb by deliberately inserting a misoriented sheet and then turning it over with a setupsheet.
Cyril.f's line also works very well for me, be.adl there is one thing that surprises me a bit in your code example, you define a swDraw variable as a DrawingDoc but you work on the Part variable that you defined as a ModelDoc2 in your NewSheet3 and SetupSheet5 functions, is this voluntary and would the difference in operation come from there?
In fact, going back to Modeldoc2 or drawingDoc allows me to have access to activateSheet() for the new sheet created o. I haven't checked if it's really necessary but it works like that.
As for the operation of Newshhet4(), for me it only stutters when the new sheet inserted has the same format and orientation as the sheets already present in the original document.