I created a small script which opens a document of your choice. Check the code below to see how.
Here's my problem: It is still possible to open a document, even when it's already open. This makes it confusing, so I'd like to have this document on top of the other open files. (is this clear??).
I would like to add another script which 'activates' the document which is already open.
How can this be achieved?
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim pathMacro As String
Dim pathModels As String
Dim pathModel As String
Private Sub OpenMe_Click()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
pathMacro = swApp.GetCurrentMacroPathFolder
pathModels = pathMacro & "\Models\"
Select Case Me.ComboBox.value
Case "Bicycle Rack"
Set Part = swApp.OpenDoc6(pathModels & "Bicycle Rack\Bicycle Rack.SLDASM", 2, 0, "", longstatus, longwarnings)
Case etcetera etcetera.....
End Select
End
End Sub
Try these codes