4 Replies Latest reply on Aug 21, 2012 8:23 AM by alexanderklapfer

    Copy to new artboard with transformation in VBA

    alexanderklapfer Level 1

      Hallo Forum,


      I have the common problem to resize the artboard to standardize technical illustrations to the format 50x50mm. So I found good help in the forum (thank you). I have some problem and may somebody can help me:


      • I would like to group the objects for further transformations
      • I would transform the group to 45mm and scale stroks and effects

      N.B.: here It should be a test on landscape format


      • I would align the group to the page center


      This is my code, may somebody can help me ?


      Thank you to every replay

      Regards Alex


      Public Sub copy_paste_with_transformation ()

      'Duplicates grouped items in a new document with landscape sensitive transformation

      Set appRef = CreateObject("Illustrator.Application")


      'calculate the size of objects do define if it's landscape or not

      Bounds = appRef.ActiveDocument.VisibleBounds


      'If the group is landscape the lenth should be 45mm otherwise the higth


      appRef.ActiveDocument.GroupItems 'problem

      appRef.ActiveDocument.SelectObjectsOnActiveArtboard 'may a solution for CS4 too


      appRef.ActiveDocument.Resize(45, 45) 'problem




      Set newDocument = appRef.Documents.Add(aiDocumentCMYKColor, 50, 50) 'Paper size is 50mm



      'Align group to page center hrizontal and vertical



      End Sub