AnsweredAssumed Answered

Use sendkey to navigate in menu from API

Question asked by Niels Raahauge on Mar 13, 2019
Latest reply on Mar 14, 2019 by Amen Allah Jlili

'Hwo can I send keyestokes to a open menu i sw?

 

'Link to what I think need to be used - but I can nor´t figure out how

'2018 SOLIDWORKS API Help - Keystrokes and Accelerator Keys in ActiveX Modeless Dialogs and Property Manager Pages

 

 

'I want the SW dxf preview to pop up - In save as dialog I need keystroke from VBA to finish SW dialog instant of using ex  swModelDocExt.SaveAs

 

'Predoncition sheetmetal SWP open

'Open Save as dialog

'select save as dxf via sendkey

 

Option Explicit

   

Sub main()

 

Dim swApp                   As SldWorks.SldWorks

Dim swModel                 As SldWorks.ModelDoc2

Dim lErrors             As Long

Dim lWarnings           As Long

Dim bool As Boolean

Dim sPath_Filename As String

     

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

 

sPath_Filename = swModel.GetPathName

 

swApp.ActivateDoc3 sPath_Filename, False, swRebuildOnActivation_e.swRebuildActiveDoc, lErrors

bool = swModel.Extension.RunCommand(SwCommands.swCommands_SaveAs, "")

 

SendKeys ("{UP 3}")

SendKeys ("{ENTER}")

SendKeys ("{TAB}")

SendKeys ("d")

 

End Sub

Outcomes