Windows 11, Adobe Illustrator, macros in Excel

New Here ,
Feb 03, 2022 Feb 03, 2022

Copy link to clipboard

Copied

I have updated windows from 10 to windows 11, now scripts not working. Any one able to help with following error. Script still work on a windows 10 machine. 

Adobe Illustrator 26.0.3

Script in Excel  

Dim AiDoc As Illustrator.Document

Set AiDoc = Illustrator.ActiveDocument - Error 80004002 No such interface supported.

Excel References; Visual Basic for Applications, Microsoft Excel 16.0 Object Library, Adobe Illustrator 26 Type Library, OLE automation, Microsoft Office Library 1.60 Object Library

 

Updated Illustrator and still have a problem.

Any recommendations

 

 

 

 

 

TOPICS
Scripting

Views

60

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 03, 2022 Feb 03, 2022

Copy link to clipboard

Copied

Just to add some code missed.

Sub Main()
   Dim AdobeDoc As Illustrator.Document

   GetIllustrator
   Set AdobeDoc = GetADOBEDocument

   CreateGraphics

End Sub

'------------------------------------------------------------------------
' Get Adobe Application
'------------------------------------------------------------------------
Function GetIllustrator() As Object
    Dim Adobe As Object
    Set Adobe = GetObject(, "Illustrator.Application")
    If Adobe Is Nothing Then
         Set Adobe = CreateObject("Illustrator.Application")
         Adobe.Visible = True
    End If
    Set GetIllustrator = Adobe
End Function

'------------------------------------------------------------------------
' Get ADOBEDocument
'------------------------------------------------------------------------
Function GetADOBEDocument() As Illustrator.Document
    Dim MyAdobeDocument As Illustrator.Document
    Dim Adobe As Object
    Set Adobe = GetIllustrator
    Set MyAdobeDocument = Illustrator.ActiveDocument
    Set GetADOBEDocument = MyAdobeDocument
End Function

 

Private Sub CreateGraphics()
    Dim AiPathItem As Illustrator.PathItems
    Dim AiTextFrame1 As Illustrator.TextFrame
    Dim Ellipses As Illustrator.PathItems

....

    Set AiDoc = GetADOBEDocument - Error

.....

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2022 Feb 05, 2022

Copy link to clipboard

Copied

Fix found was:-

Dim Win10 As Boolean

Dim Lt as Double

Dim Tp as Double

Dim Rt as Double

Dim Bt as Double

 

Win10 = False

If Win10 = True Then
    Dim aDoc As Illustrator.Document
    Set aDoc = Illustrator.ActiveDocument
    Lt = aDoc.Artboards.Item(1).ArtboardRect(0) / Pm
    Tp = aDoc.Artboards.Item(1).ArtboardRect(1) / Pm
    Rt = aDoc.Artboards.Item(1).ArtboardRect(2) / Pm
    Bt = aDoc.Artboards.Item(1).ArtboardRect(3) / Pm
Else
    Dim iDoc As Object
    Dim aRect As Variant
    Set ADOBE = CreateObject("Illustrator.Application")
    Set iDoc = ADOBE.ActiveDocument
    Set aBoard = iDoc.Artboards.Item(1)
    aRect = aBoard.ArtboardRect(0)
    Lt = aRect(0) / Pm
    Tp = aRect(1) / Pm
    Rt = aRect(2) / Pm
    Bt = aRect(3) / Pm
End If

Something to do with binding, not sure that I understand, but now works in windows 10 and 11.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 05, 2022 Feb 05, 2022

Copy link to clipboard

Copied

LATEST

thanks for sharing! yes it has something to do with early binding. It's happened before on earlier versions of Ai, glad to see you found an alternative.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines