API Documentation > CorelDRAW > 2025-v26 > Text > IVGText
Text.ExportToFile method
Exports given range to a file
Syntax:
Sub ExportToFile(ByVal FileName As String, ByVal StartIndex As Long, ByVal Count As Long, Optional ByVal IndexingType As cdrTextIndexingType = cdrCharacterIndexing)
Parameters:
Name Type Description
FileName
String
StartIndex
Long
Count
Long
IndexingType
Specifies the type of text to be indexed, and returns a value of cdrTextIndexingType. The indexing type can be character, word, or paragraph.
Remarks:
The ExportToFile method saves a portion of a text object to a text file.
Examples:
The following VBA example saves the second-to-fifth paragraphs to a text file, and it then inserts that text at the beginning of the text object.
Sub Test()
ActiveShape.Text.ExportToFile "C:\Temp.txt", 2, 4, cdrParagraphIndexing
ActiveShape.Text.ImportFromFile "C:\Temp.txt", 1, cdrParagraphIndexing 
End Sub