AnsweredAssumed Answered

SendKeys in VBA

Question asked by Stuart Coutts on Nov 28, 2012
Latest reply on Nov 28, 2012 by Stuart Coutts

I started to write a program to set up printer properties based on the sheet size. Because we use different sizes of long plot, the idea was to take the sheet size and then transpose that over to the printer properties, then I can output a print or a tif etc.


My problem is... I keep getting an error code 70 (permission denied) when I try to send keys.


Here is my code so far...




Dim swApp As Object
Dim swModel As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long


Sub main()


     Dim L
     Dim W


     Set swApp = Application.SldWorks
     Set swModel = swApp.ActiveDoc


     L = 46.5
     W = 11


     SendKeys "%{f}{p}{p}{m}", False
     SendKeys "{TAB 11}{UP}", False
     SendKeys "{TAB 13}" & L & "{TAB}" & W & "{TAB 3}{ENTER}{TAB 5}{ENTER}", False
     SendKeys "{TAB 4}{ENTER}{TAB 6}{ENTER}{TAB 14}{ENTER}", False


End Sub



Ive only used sendkeys once or twice before but I think it was in VB. Another post showed the sendkeys working without the { } so I tried that. Still get the code 70.


Any ideas?