VBA syntax to access picture background color

I need to change every display background based on the workstation.  I know I can edit each display, but I need this to be global and work even when someone copies over a new picture.  I've gotten something to work, running in a schedule, but instead of just the main picture's background changing, it changes all the faceplates and detail displays along with the alarm banner.  How do I drill down to just the main display's properties?

  • Never mind, I finally figured out what I was doing wrong. I haven't seen anything quite like this asked or talked about so, for what it's worth here's what worked for me. And if anyone sees I'm doing something wrong, please let me know! Thanks guys.
    =================================================================================================
    Option Explicit

    Private Sub BG_Color_OnTimeOut(ByVal lTimerId As Long)
    On Error GoTo ErrorHandler

    Dim objPicDoc As Object
    Dim objPicPage As Object
    Dim objPicWin As Object
    Dim lColor As Long

    lColor = 12365030

    If StrComp(frsGetComputerName, "MyWorkStationName", vbTextCompare) = 0 Then
    Set objPicDoc = Application.ActiveDocument
    Set objPicPage = objPicDoc.Page
    Set objPicWin = Application.ActiveWindow
    If InStr(1, objPicWin.WindowName, frsPictureNickname(PRIMARY_SCREEN, MAIN_PICTURE), vbTextCompare) > 0 Then
    If objPicPage.BackgroundColor <> lColor Then
    objPicPage.BackgroundColor = lColor
    End If
    End If
    End If
    Exit Sub

    ErrorHandler:
    frsHandleError
    End Sub
    =================================================================================================
  • In reply to eXcelonPrime:

    There is something similar in an old article AUS1-110-020114084027 which relates to changing the background colour before printing. This uses a different method to get a reference to the main picture but I couldn't say whether it is better or worse than yours.