In the IDE, use the following code for the method:
Public Sub MyFirstMacroDocVB()Dim baseVec As Autodesk.Revit.DB.XYZ = Document.Application.Create.NewXYZ(1.0, 0.0, 0.0)Dim upVec As Autodesk.Revit.DB.XYZ = Document.Application.Create.NewXYZ(0.0, 0.0, 1.0)Dim origin As Autodesk.Revit.DB.XYZ = Document.Application.Create.NewXYZ(0.0, 0.0, 0.0)Dim align As Autodesk.Revit.DB.TextAlignFlags = Autodesk.Revit.DB.TextAlignFlags.TEF_ALIGN_LEFT Or Autodesk.Revit.DB.TextAlignFlags.TEF_ALIGN_TOPDim pView As Autodesk.Revit.DB.View = Document.ActiveView Dim Transaction As Autodesk.Revit.DB.Transaction = New Autodesk.Revit.DB.Transaction(Document, "NewTextNote")Transaction.Start()Document.Create.NewTextNote(pView, origin, baseVec, upVec, lineWidth, align, strText)Transaction.Commit()End Sub
For this example, when you build the project in the Revit macro IDE, notice that you are building the DocVisualBasic project, and your Document-level VB.NET macro's code resides in ThisDocument.vb. You can use the IDE's Project Explorer to see its temporary location on disk. Recall that the code for successfully built Document-level macros are stored in the RVT file after you Save the RVT file. The project files are removed from the temporary location when you exit Revit.
The macro placed text box