using openDoc6 browse for missing file.
using openDoc6 browse for missing file.
How can I trigger the browse for file popup if using openDoc6?
Re: using openDoc6 browse for missing file.
Typically the coder launches the file browser dialog, and feeds the values returned to the openDoc function.
This explains how it was done in VB6. I can't say if that is still up to date for the modern Solidworks VB API
http://www.vb-helper.com/howto_select_file.html
This explains how it was done in VB6. I can't say if that is still up to date for the modern Solidworks VB API
http://www.vb-helper.com/howto_select_file.html
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
Re: using openDoc6 browse for missing file.
Whoops, I had this question open in another tab. Must have submitted by accident without giving all info.
Was trying to get this dialog when a referenced part is missing from the drawing using this code
The dialog opens when opening from explorer or from solidworks file menu, but not api. My solution was to open the drawing manually and select Checked "don't show again" before selecting "Browse for file". Now openDoc6 will automatically present the open file window when something is missing.
Was trying to get this dialog when a referenced part is missing from the drawing using this code
Code: Select all
Dim swApp As Object
Sub main()
Set swApp = Application.SldWorks
Dim err As Long
Dim warn As Long
dim fileP as string
fileP = "mypath"
Set res = swApp.OpenDoc6(fileP , swDocumentTypes_e.swDocDRAWING, swOpenDocOptions_e.swOpenDocOptions_Silent, "", err, warn)
Debug.Print res.GetTitle
Debug.Print err
Debug.Print warn
End Sub
- Stefan Sterk
- Posts: 37
- Joined: Tue Aug 10, 2021 2:40 am
- x 51
- x 77
Re: using openDoc6 browse for missing file.
Hi @colt,
Replace swOpenDocOptions_e.swOpenDocOptions_Silent with Empty or -1.
swOpenDocOptions_e.swOpenDocOptions_Silent suppresses the warning dialogs like missing file.
Instead of
Replace swOpenDocOptions_e.swOpenDocOptions_Silent with Empty or -1.
swOpenDocOptions_e.swOpenDocOptions_Silent suppresses the warning dialogs like missing file.
Code: Select all
Set res = swApp.OpenDoc6(fileP , swDocumentTypes_e.swDocDRAWING, Empty, "", err, warn)
Code: Select all
Set res = swApp.OpenDoc6(fileP , swDocumentTypes_e.swDocDRAWING, swOpenDocOptions_e.swOpenDocOptions_Silent, "", err, warn)
Re: using openDoc6 browse for missing file.
Hmmm, when I use -1 it opens the document as [Viewing] [Read-only]. When Empty it loads as if I had the silent option. I made sure to allow all dismissed messages in options. I am on 2018, so maybe it works in newer versions.