none
Change Colorscheme in Publisher 2007 VBA RRS feed

  • Question

  • I am creating an application that runs in MS Access 2007, automating the opening, modification and saving of Publisher 2007documents.

    However, I have run into an issue when attempting to change the colorscheme in VBA using:

    pubDoc.ColorScheme=pubApp.ColorSchemes("WildFlower") 

    Where pubDoc and pubApp are objects representing an active Publisher document and application respectively (and other operations with these objects in the VBA code works fine)

    The above code returns an error indicating 'invalid procedure call or argument.'

    Any ideas for a fix are greatly appreciated!

    Friday, November 15, 2013 7:51 PM

All replies

  • Hi,

    Could you show me your complete code?I try to reproduce you issue in my side ,but failed,Here is my tested code:

    Sub OperatePublisher()
    Set pubApp = CreateObject("Publisher.Application")
    Set pubDoc = pubApp.ActiveDocument
    pubDoc.ColorScheme = pubApp.ColorSchemes("WildFlower")
    End Sub

    >>The above code returns an error indicating 'invalid procedure call or argument.'

    An argument probably exceeds the range of permitted values.This error can also occur if an attempt is made to call a procedure that isn't valid on the current platform.

    More information ,you can refer to  the link below:

    http://msdn.microsoft.com/en-us/library/aa445484(v=vs.60).aspx

    Regards,

    Monday, November 18, 2013 10:04 AM
  • Thanks for responding.  The code that is causing the issue:


     Dim pubApp As publisher.Application
    Dim pubDoc As publisher.Document

    Set pubApp = New publisher.Application
    Set pubDoc = pubApp.Documents.Add.Application.Open("<path to publisher file>")

    pubDoc.ColorScheme = pubApp.ColorSchemes("WildFlower")

    Again, thanks for your attention to this.





    Tuesday, November 19, 2013 5:54 PM
  • PS I have set up the 'References' in my Access code to the Publisher object library...
    Tuesday, November 19, 2013 5:54 PM