Alright, I've looked everywhere and I can't seem to find a true answer, if there even is one.
I have a macro that will traverse all my drawing sheets and update my drawing sheets and this works fine. While updating the sheets, I also want all sheets to have the same custompropertview View #, which just so happens to be on page #1. Currently I can get page 1 to set to the view on page 1 (Ex: Drawing View1). The problem is that I can't get Drawing View1 to be set for Page 2 and more because Drawing View 1 only exists on Page 1.
The manual solution is to go to each page, right click, go to properties and in "Use custom property values from model shown in:" drop down select Drawing View 1.
I can't rely on "Default" as the property to use because not all drawings have started on page 1 hence "Default" doesn't always represent Drawing View 1.
I currently have Solidworks 2015 SP 2.0 installed.
Here is my code:
Dim swView As SldWorks.View
Dim bRet As Boolean
Dim vSheetNames As Variant
Dim Fsheet As sheet
Dim Osheet As String
Dim Name As String
Dim vSheetProps As Variant
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
Set swSheet = swDraw.GetCurrentSheet
'get list of sheet names
vSheetNames = swDraw.GetSheetNames
'get current sheet name
Osheet = swSheet.GetName
'Go to First Sheet
bRet = swDraw.ActivateSheet(vSheetNames(0))
Debug.Print "First Sheet " & vSheetNames(0)
'Get First Sheet View Name
Set swView = swDraw.GetFirstView
Set swView = swView.GetNextView
Name = swView.GetName2
Debug.Print "First View " & Name
'Set sheet custom property name to view
Set swSheet = swDraw.GetCurrentSheet
swSheet.CustomPropertyView = Name
'Traverse all sheets and change view property
For i = 0 To UBound(vSheetNames)
Debug.Print "********************************"
bRet = swDraw.ActivateSheet(vSheetNames(i))
Debug.Print "Sheet " & vSheetNames(i) & " before - view " & Name
Set swSheet = swDraw.GetCurrentSheet
'Place "Default" to change all the pages to be default view, which didn't work correctly.
'Name = "Default"
swSheet.CustomPropertyView = Name
Debug.Print "Sheet " & vSheetNames(i) & " after - view " & swSheet.CustomPropertyView
Next i
'Go Back to original sheet
bRet = swDraw.ActivateSheet(Osheet)
End Sub
SolidworksApi macros