Try these codes:
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swPageSetup As SldWorks.PageSetup
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swPageSetup = swModel.PageSetup
swPageSetup.ScaleToFit = True
swPageSetup.Orientation = 2 ' 1=Portrait '2 = Landscape
swPageSetup.DrawingColor = 3 ' 1=Automatic Drawing Color '2 = Color Grey '3 = Black And White
swPageSetup.HighQuality = False
swPageSetup.PrinterPaperSize = 1
Thanks for responding,
I tried the code, It's not working.
I have tried one more, This perfectly works except the "drawingcolor" & "high quality" line code 4 & 5 from bottom
Could you please help
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Set swApp = _
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
Dim myPageSetup As Object
Set myPageSetup = Part.Extension.AppPageSetup
Dim mySheet As Object
Set mySheet = Part.Sheet("Drawing 1")
Set myPageSetup = mySheet.PageSetup
myPageSetup.ScaleToFit = True
myPageSetup.DrawingColor = swPageSetupDrawingColor_e.swPageSetup_BlackAndWhite
myPageSetup.HighQuality = False
myPageSetup.Orientation = swPageSetupOrientation_e.swPageSetupOrient_Landscape
myPageSetup.PrinterPaperSize = 1
The above codes will set up the settings for the complete document instead of each sheet. I'm not sure why the option doesn't work for each sheet so better use the settings for the complete drawing.
Also write back to your VAR or SW API team for more info on this.
Thanks a lot,
I understand from your reply that, the codes sent by you doesn't work due to some settings issue ?
Should I check to include some 'library references' in SW.
Anyways, as recommended by you, I will escalate to our API team.
The codes I have shared above works fine for me (for setting the complete drawing and not individual sheet). Don't they work for you?
Yes Deepak, The codes didn't work.
When I run macro, it was just silent. didn't work
Can you send me a sample drawing and macro you're using (if different or modified from one I had pasted above)
Hi Deepak, I have attached the sample drawing & macro. It's visible in first thread of this conversation
Dinesh Ramasubbu, not sure if this is a bug or something else. The macro I posted above was working fine the other day but now has stopped working.
I would suggests you to please check with your VAR or SW API team for a resolution.