VB API Replace sheet format - No option to delete the old one
Hi,
We are changing our drawing format to change the layout. Below is my VB code to set the drawing with a new format. The code only half worked.
The new format could be applied, but the old format stayed. I had been searching up and down and try to find if there was an option of "replace" but I couldn't find anything. The online VB help about "IpfcDrawingFormat" has no help at all
Can anyone please help?
Dim currentDrawing As IpfcDrawing = CType(session.CurrentModel, IpfcDrawing)
'Replace format
Dim NewFormatName As String = "new-d.frm"
Dim frmDescr As IpfcModelDescriptor
frmDescr = (New CCpfcModelDescriptor).CreateFromFileName(NewFormatName)
Dim NewFormat As IpfcDrawingFormat
NewFormat = session.RetrieveModel(frmDescr)
Dim sheets As Integer
Dim i As Integer
Dim CurrentShtOwner As IpfcSheetOwner
CurrentShtOwner = CType(currentDrawing, IpfcSheetOwner)
sheets = CurrentShtOwner.NumberOfSheets
For i = 1 To sheets
CurrentShtOwner.SetSheetFormat(i, NewFormat, Nothing, Nothing)
Next
