Draw on UCS Front View

Instead of drawing on the default top view. The code below will show how to draw on the front view ' set the world ucs With acadDoc Set currUCS = .UserCoordinateSystems.Add(.GetVariable("UCSORG"), .Utility.TranslateCoordinates(.GetVariable("UCSXDIR"), acUCS, acWorld, 0), .Utility.TranslateCoordinates(.GetVariable("UCSYDIR"), acUCS, acWorld, 0), "OriginalUCS") End With 'Create a UCS and make it current origin(0) = 0: origin(1) = 0: … Continue reading Draw on UCS Front View

Add a Viewport and Show Front View

This will create a viewport in paper space and instead of the standard top view, the viewport will show as the front view center(0) = 5.4682: center(1) = 1.4055 dblviewdirection(0) = 0: dblviewdirection(1) = -1: dblviewdirection(0) = 0 Set pviewportObj = acadDoc.PaperSpace.AddPViewport(center, vpwidth, 2.2565) pviewportObj.direction = dblviewdirection pviewportObj.Layer = "viewport" pviewportObj.Display True acadDoc.MSpace = True … Continue reading Add a Viewport and Show Front View

Run a Macro at a Specific Time

Sub ImportModules() Debug.Print "test" End Sub Private Sub Workbook_Open() Application.OnTime Now + TimeValue("00:00:01"), "domeprog.ThisWorkbook.ImportModules" End Sub The code above will run the macro called 'ImportModules' one second after the workbook is opened. If the macro is located in a class module or in ThisWorkbook class, then you will need to call out the library + … Continue reading Run a Macro at a Specific Time

Clear All Check Boxes In Excel VBA Userform

This example uses a for each loop so that each check box name does not have to be explicitly written out. This is useful when you are adding more control and limit the amount of code you are writing. Better Method Dim ctrl As Control Sub ClearAllButton_Click() For Each ctrl In exportFilesUF.Controls If TypeName(ctrl) = … Continue reading Clear All Check Boxes In Excel VBA Userform