Import an Image then reference it in code

I created a macro to import batch of bitmap files using ImportEx, how do I reference the imported each of bitmap in my code so I can modify it in document? (Like setting its dimensions, etc.)

I looked at ImportEx documentation and it returns an ImpFlt object, I have no idea what to do with this.

Parents
No Data
Reply
  • ImportEx returns an ImportFilter indeed. But immediately after import, the ActiveShape will be the imported one...

    And I would suggest to use Import... It imports the file keeping its name. See the next code please:

    1
    2
    3
    4
    5
    6
    Dim sh As Shape, sh1 As Shape
    
      ActiveLayer.Import "G:\CorelDraw\StrangeFolder\JPGFolder\Test 4.JPG"
      Set sh = ActiveShape: Set sh1 = ActiveLayer.Shapes("Test 4.JPG")
      sh.SizeWidth = 200
      Debug.Print sh1.SizeWidth
    

    I checked and also ImportEx keeps the file name. So you can use the same methods, inclusive the one referring to the picture name...

    I mean for a specific folder Path (maybe using Browse for Folder) you can iterate among all files, you can filter them according to the wished extension and load a two column array (M()) with their path, respectively, their name. You can import each of them using the first column of the array and create the object shape using the second column. Set Sh = ActiveLayer.Shapes(M(1, 1))

Children