I'm trying to create a macro to apply my custom bitmap pattern fill.I found this https://community.coreldraw.com/sdk/api/draw/18/m/fill.applypatternfill but when I use the example macro and change the path to my custom .fill file, I get an error that it failed to load.
Sub Test() Dim s As Shape Set s = ActiveLayer.CreateRectangle(0, 0, 5, 5) s.Fill.ApplyPatternFill cdrBitmapPattern, "C:\Users\jchestnut\Documents\Corel\Corel Content\Fills\CoolerWrap Wood 1.fill" End Sub
Try to use following code
Sub Test() Dim s As Shape Set s = ActiveLayer.CreateRectangle(0, 0, 5, 5)ActiveSelection.Fill.ApplyFountainFill s.Style.Fill.LoadFill ("c:\Gold Leaf.fill") 'path to your file *.fillEnd Sub
Edit: your code is working with bitmap fills
One more question. Let's say I adjusted the pattern scale to be larger. How would I copy that new scale to the other shapes with VBA? I can do it manually with the attributes eyedropper tool.