Fill selected object by file.

Hello all,

I have searched for weeks now and can not figure out this problem.

all I want to do is ues a .Fill file to fill a selected object.  I have used the record macro feature and came up with this code

Sub TemporaryMacro()
    ' Recorded 7/13/2019
    Dim OrigSelection As ShapeRange
    Set OrigSelection = ActiveSelectionRange
    OrigSelection(1).Style.StringAssign "{""fill"":{""type"":""9"",""primaryColor"":""CMYK255,USER,0,0,0,0,100,cccd19cb-4675-4a5e-8bda-d0bbbaab8af0"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000"",""overprint"":""0"",""tilingInterTileOffset"":""0"",""tilingHeight"":""1016000"",""tilingFlagsMirrorVertical"":""0"",""fillName"":""cc613529-4bf9-4200-93f9-14cc2b217794.24.colorbitmap"",""tilingXOffset"":""0"",""tilingFlagsNoSeams"":""0"",""tilingFlagsMirrorHorizontal"":""0"",""tilingWidth"":""1016000"",""tilingFlagsColumnOffset"":""0"",""tilingFlagsScale"":""0"",""tilingFlagsScaleToObject"":""0"",""skew"":""0"",""tilingYOffset"":""0"",""angle"":""0""},""outline"":{""color"":""CMYK,USER,0,0,0,100,100,00000000-0000-0000-0000-000000000000"",""width"":""1764""},""transparency"":{}}"
    OrigSelection(1).Style.StringAssign "{""fill"":{""type"":""9"",""primaryColor"":""CMYK255,USER,0,0,0,0,100,cccd19cb-4675-4a5e-8bda-d0bbbaab8af0"",""secondaryColor"":""CMYK,USER,0,0,0,0,100,00000000-0000-0000-0000-000000000000"",""overprint"":""0"",""tilingInterTileOffset"":""0"",""tilingHeight"":""1016000"",""tilingFlagsMirrorVertical"":""0"",""fillName"":""980ea7ed-30d3-4800-97b9-7c561de7db79.23.colorbitmap"",""tilingXOffset"":""0"",""tilingFlagsNoSeams"":""0"",""tilingFlagsMirrorHorizontal"":""0"",""tilingWidth"":""1016000"",""tilingFlagsColumnOffset"":""0"",""tilingFlagsScale"":""0"",""tilingFlagsScaleToObject"":""0"",""skew"":""0"",""tilingYOffset"":""0"",""angle"":""0""},""outline"":{""color"":""CMYK,USER,0,0,0,100,100,00000000-0000-0000-0000-000000000000"",""width"":""1764""},""transparency"":{}}"
End Sub

The file that I am trying to load is "C:\Users\username\Documents\Corel\Corel Content\Fills\ Starter pack\Bitmap Pattern 021.fill"

It will work fine with the recorded code on one computer but will not run on a different computer, both computers have the same file,

I have tried replacing the "fillName"":""980ea7ed-30d3-4800-97b9-7c561de7db79.23.colorbitmap" section with the file path but this dose not work on either computer.

Anyone have any Idea how to make this work. If it makes a difference I can move all 300 colors to a shared network drive so all the computer are reading from the same file. not there own user name folder.

Just to clarify all i want to do is fill the selected object using a .fill file seams like this should be easy but I give up.

Thank you in advance for any help.

Parents Reply
  • there is like 20 lines of code with this that looks like it could be 1 line if anyone knows how to do it the other way

    What I posted could have many fewer lines of code if I took away all of the "safeties" that I included to avoid generating an error if the macro were run with no document open, or with no object selected, or with multiple objects selected, or with a single object selected that cannot have a fill.

    If there is a better way to apply a bitmap pattern fill, then I hope that someone posts it here so that I can learn about it.

No Data