PublishToPDF macro bug

I am having trouble with producing pdf files where all objects are output as RGB. Design objects made with Pantone spot colors are not converted to RGB colors when the pdf is produced. 

When using the built in Publish to pdf function it works fine, but when I record the same settings to a macro the debugger stops executing the macro at he yellow line in the code below.

Anyone having a workaround or solution? I have tried all possible settings and combinations to no luck. 

Sub pdf_spot_to_rgb()

' Recorded 27.01.2016
With ActiveDocument.PDFSettings
.PublishRange = 0 ' CdrPDFVBA.pdfWholeDocument
.PageRange = "1"
.Author = "Vidar Strand"
.Subject = ""
.Keywords = ""
.BitmapCompression = 2 ' CdrPDFVBA.pdfJPEG
.JPEGQualityFactor = 25
.TextAsCurves = False
.EmbedFonts = True
.EmbedBaseFonts = True
.TrueTypeToType1 = True
.SubsetFonts = True
.SubsetPct = 80
.CompressText = True
.Encoding = 1 ' CdrPDFVBA.pdfBinary
.DownsampleColor = True
.DownsampleGray = True
.DownsampleMono = True
.ColorResolution = 150
.MonoResolution = 400
.GrayResolution = 200
.Hyperlinks = True
.Bookmarks = True
.Thumbnails = False
.Startup = 0 ' CdrPDFVBA.pdfPageOnly
.ComplexFillsAsBitmaps = False
.Overprints = True
.Halftones = False
.MaintainOPILinks = False
.FountainSteps = 256
.EPSAs = 0 ' CdrPDFVBA.pdfPostscript
.pdfVersion = 6 ' CdrPDFVBA.pdfVersion15
.IncludeBleed = False
.Bleed = 31750
.Linearize = False
.CropMarks = False
.RegistrationMarks = False
.DensitometerScales = False
.FileInformation = False
.ColorMode = 0 ' CdrPDFVBA.pdfRGB
.UseColorProfile = True
.ColorProfile = 1 ' CdrPDFVBA.pdfSeparationProfile
.EmbedFilename = ""
.EmbedFile = False
.JP2QualityFactor = 25
.TextExportMode = 0 ' CdrPDFVBA.pdfTextAsUnicode
.PrintPermissions = 0 ' CdrPDFVBA.pdfPrintPermissionNone
.EditPermissions = 0 ' CdrPDFVBA.pdfEditPermissionNone
.ContentCopyingAllowed = False
.OpenPassword = ""
.PermissionPassword = ""
.EncryptType = 1 ' CdrPDFVBA.pdfEncryptTypeStandard
.OutputSpotColorsAs = 1 ' CdrPDFVBA.pdfSpotAsRGB
.OverprintBlackLimit = 95
End With
ActiveDocument.PublishToPDF "Y:\Firma\Corel Stuff\X7\Bug\spot_to_rgb_bug.pdf"

End Sub

spot_to_rgb_bug.cdr