Example 13 - sw_size.swb

' ****************************************************************
' SW_SIZE.SWB
' 
'	Joe Jones   		joe@nhcad.com
' 	NEW HAMPSHIRE CAD	www.nhcad.com
'
' This macro is used to set the width and height of your
' active SolidWorks window in pixels.
'
' It is ideally suited for making TIFF images (File/Save As/Tiff)
' and giving you some control over the final size of the image. It
' takes into account the width of your feature tree and adjusts 
' accordingly.
'
' ****************************************************************
Sub Main()
	Dim swApp As Object
	Dim modelDoc As Object
	Dim modelView As Object		  
	Dim hght, wdth, fram As Double
    
	'get SolidWorks
	Set swApp = CreateObject("SldWorks.Application")
	Set modelDoc = swApp.ActiveDoc

    'get size of active SW window
    Set modelView = modelDoc.ActiveView
	wdth = InputBox("Width",,640)
	hght = InputBox("Height",,480)
	fram = modelDoc.GetFeatureManagerWidth
	modelView.FrameWidth = wdth + fram
	modelView.FrameHeight = hght

	Set modelView = Nothing
	Set modelDoc = Nothing
	Set swApp = Nothing
End Sub