Trouble with VBA script to automate Illustrator to get and loop through all textFrames
I wrote the following code to get and loop through all the textFrames in a pdf opened in Illustrator:
Sub editPDF(filePath As String)
Dim iapp As New Illustrator.Application
Dim idoc As Illustrator.Document
Dim pdfText As String
With iapp.Preferences.pdfFileOptions
.PageToOpen = 1
End With
iapp.UserInteractionLevel = aiDontDisplayAlerts
Set idoc = iapp.Open(filePath)
Set idoc = iapp.ActiveDocument
Set myTextFrames = idoc.TextFrames
For Each TextFrame In idoc.TextFrames
pdfText = TextFrame.Contents
MsgBox (pdfText)
Next
idoc.Close
Set idoc = Nothing
Set iapp = Nothing
End Sub
However, when I run this code some of the textFrames are inexplicably not included in the collection list idoc.TextFrames. The file only has a single layer. The one thing I can think of is that the files that I am opening include fonts that I don't have installed on my workstation (this will be corrected soon). But some of the textFrames that use the bad fonts DO show up in this list, so I am very confused.