Closing a new document with textvariable
1. In Indesign CS4 version 6.0.2 ,
if I create a new document and insert a textvariable, I can save the document and I can close it.
2. In scripting Indesign CS4 version 6.0.2 with VB.net (Visual Studio 2008 + Framework 3.5),
if I open a document manually created under Indesign CS4 version 6.0.2 with a textvariable, I can save the document and I can close it.
3. In scripting Indesign CS4 version 6.0.2 with VB.net (Visual Studio 2008 + Framework 3.5),
if I create a new document and insert a textvariable, I can save the document, but I can't close it. Indesign give a win32 error.
MyPub = myIndesign.Documents.Add(False)
MySpread = MyPub.Spreads.Item(1)
myTextFrames = MySpread.TextFrames
MyInfos = myTextFrames.Add
Dim FileNameVariable As InDesign.TextVariable = Nothing
For Each Item As TextVariable In MyPub.TextVariables
If Item.VariableType = idVariableTypes.idFileNameType Then
FileNameVariable = Item
Exit For
End If
Next
Dim FileNameVariableInstance As InDesign.TextVariableInstance = Nothing
FileNameVariableInstance = MyInfos.TextVariableInstances.Add(idLocationOptions.idAtBeginning)
FileNameVariableInstance.AssociatedTextVariable = FileNameVariable
MyPub.Save(FullPath) 'OK
MyPub.close 'Error Win32 in Indesign.exe
I try to save the document before creating the FileNameVariableInstance but it's the same result.
Do you know a way to do it ?
Regards