Solved! Go to solution

Set Active Draft Sheet's Background

I've seached prior post's and can't figure this out...

I knowo this has got to be just a single call that I cant seem to get right...


Any help is much appreaciated!!!


I know the name of my background sheet.

I know my active sheet.


I want to set my active sheet’s background…


Can anyone help me out here?


Dim objApp As SolidEdgeFramework.Application = Nothing

objApp = Marshal.GetActiveObject("Solidedge.Application") 'try to connect to running instance of SE


Dim objWorkingDft As SolidEdgeDraft.DraftDocument = Nothing

objWorkingDft = objApp.ActiveDocument


Dim objBackground As SolidEdgeDraft.Sheet

objBackground = objWorkingDft.Sections.Item("Backgrounds").Sheets.Item("PAC_B_Wide")


'here I need to set "objWorkingDft"'s background to "objBackground"

'Same as manual UI RMB on sheet tab - sheet set up, Background tab - then select background sheet, check on SHow Background


??? Stumped!!!

Accepted by topic author MattJohnsonPAC
‎08-26-2015 04:32 AM

Re: Set Active Draft Sheet's Background

objWorkingDft.ActiveSheet.Background = objBackground


Kind regards,
Wolfgang Kunert -
Accepted by topic author MattJohnsonPAC
‎08-26-2015 04:32 AM

Re: Set Active Draft Sheet's Background

additional the the sheet size must be set:
objWorkingDft.ActiveSheet.SheetSetup.SheetSizeOption = objBackground.SheetSetup.SheetSizeOption

VS2015, SE ST10

Re: Set Active Draft Sheet's Background

thanks much!!!   i knew it was just 1 line of code but for the life of me couldnt seem to get it right!

Re: Set Active Draft Sheet's Background

Thanks JB,  Im setting sheet size earlier in my code when im pasting it in....  Had that...  just couldnt figure out how to turn on the background sheet.


thanks much!

Re: Set Active Draft Sheet's Background

just to document this for the sake of all and future searches.



Option Explicit On


'The following code sample shows how you can select and set a sheet size

'and a background using VB automation


Module Module1


    Sub Main()

        Dim App As SolidEdgeFramework.Application

        Dim Doc As SolidEdgeDraft.DraftDocument

        Dim ActiveSheet As SolidEdgeDraft.Sheet

        Dim Section As SolidEdgeDraft.Section

        Dim BackgroundSection As SolidEdgeDraft.Section

        Dim ForegroundSection As SolidEdgeDraft.Section

        Dim WorkingSheet As SolidEdgeDraft.Sheet


        Dim I As Integer

        Dim SheetName As String


        App = GetObject(, "SolidEdge.Application")

        Doc = App.ActiveDocument

        ActiveSheet = Doc.ActiveSheet


        'Set the sheet size

        ActiveSheet.SheetSetup.SheetSizeOption = SolidEdgeDraft.PaperSizeConstants.igAnsiAWide


        'Set the corresponding background

        ActiveSheet.Background = Doc.Sections.BackgroundSection.Sheets.Item("A-Sheet")





    End Sub


End Module