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
Solved! Go to Solution.
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.
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
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")