OpenAndActivateDocument exits macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Well I thought the OpenAndActivateDocument method should be simple, but I am getting an unexpected exit when running a Macro. Simple reproducible example shown below - what am I doing wrong? The code exits (without an error!) straight after the document has been opened and activated, and doesn't continue to subsequent code.....
Help please!
Public Sub TestOpenActivate()
Dim App As Autodesk.Revit.ApplicationServices.Application = Me.Application
Dim UIApp As UIApplication = New UIApplication(Me.Application)
' Open and activate document
Dim WorkingDocUI As UIDocument = UIApp.OpenAndActivateDocument("C:\Temp\TestProject.rvt")
' DOCUMENT IS SUCCESSFULLY OPENED AND ACTIVATED, BUT THE CODE EXITS UNEXPECTEDLY HERE.....
' Do some other stuff here...
Dim NewProjFilePath As String = App.DefaultProjectTemplate
Dim WorkingDoc As Document = App.NewProjectDocument(NewProjFilePath)
End Sub