CodePudding user response:
If just pop up open file dialog box, the with common dialog box controls,If you choose to file, and open the specific file, you need to structure the code,
CodePudding user response:
Thank you thank you thank youCodePudding user response:
Could you tell me what do you know the subsequent codePrivate Sub open_Click ()
CommonDialog2. CancelError=True 'set "CancelError" to True
On Error GoTo ErrHandler 'set the sign
CommonDialog2.=cdlOFNHideReadOnly 'Flags set filters
CommonDialog2. Filter="All Files (*. *) | *. * | Text Files" & amp; "(*.txt) | *. TXT | Batch Files (*. Bat) | *. Bat" 'specify a default filter
CommonDialog2. FilterIndex=2 'show "open" dialog
CommonDialog2. ShowOpen 'according to the selected file extensions
Text2=Mid (CommonDialog2 filename, InStr (CommonDialog2 filename, "") + 1)
The Set swApp=CreateObject (" SldWorks. Application ")
The Set Part=swApp. ActiveDoc
SwApp. Visible (True)
The Set Part=swApp. Competing OpenDoc (Text2 swDocPART)
The Exit Sub
ErrHandler: 'the user presses the "cancel" button
The Exit Sub
End Sub
My code is such, but just open the SolidWorks program
CodePudding user response:
I made of Delphi, but in the end is just started the Solidworks program, file does not open, if anyone knows, explain?Swapp:=GetOrCreateObject (' SldWorks. Application);//use function GetOrCreate create or obtain SolidWorks object
Swapp. Visible:=true;//to create Solidworks object visible
Part:=swapp. Competing OpenDoc (' E: \ \ T typical weld type single v. LDPRT ');
CodePudding user response: