Check out this threads, the first one looks promising for what you're trying to achieve:
Dim SwApp As SldWorks.SldWorks
Dim SwDraw As SldWorks.DrawingDoc
Dim SwSheetNames, SwSheet As SldWorks.Sheet
Set SwApp = Application.SldWorks
Set SwDraw = SwApp.ActiveDoc
Dim SwSelMgr As SldWorks.SelectionMgr
Set SwSelMgr = SwDraw.SelectionManager
SwSheetNames = .GetSheetNames
For ii = 0 To UBound(SwSheetNames)
Str = SwSheetNames(ii)
Set SwSheet = .GetCurrentSheet
SwSheet.SetName Replace(Str, "WN", "PL")
Hi, thanks now I am able to cycle through the sheets correctly. But like any good problem now I can't get the sheet format to update properly for each sheet.
My main issue is that I've never really messed around with VBA before so now I can't seem to figure out how to change select properties of the active sheet with macros.
Thank you! It works perfectly now! The only thing though was that I had to change the value of one "i" which was set to "0" within the loop portion of the code to get the macro to run past the first sheet of the drawing. Thanks again!
Great that it worked for you - Deepak Gupta had posted it and he sent it to me, but in multiple configs if the file was fairly large it wouldn't work for me. Could you take a snap shot of what changes you made and post.........
Sure no problem, the only part I changed was one value in the loop portion of the code shown below.
For i = 0 To UBound(vSheetName)
swDraw.ActivateSheet vSheetName(i) <---- this was originally set to vSheetName(0) so it would keep making only the first page active in each loop
Set swSheet = swDraw.GetCurrentSheet
vSheetProps = swSheet.GetProperties
'Set the sheet format to NONE
swModel.SetupSheet5 swSheet.GetName, swDwgPapersUserDefined, swDwgTemplateNone, vSheetProps(2), vSheetProps(3), False, "", 0.4318, 0.2794, "Default", True
'Reload the sheet format from the speicifed location
swModel.SetupSheet5 swSheet.GetName, swDwgPapersUserDefined, swDwgTemplateCustom, vSheetProps(2), vSheetProps(3), False, sTemplatePath & sTemplateName, 0.4318, 0.2794, "Default", True
Hopefully this helps so that the code works on drawings that have more than one sheet.