Hi everyone,
I'd like to write a procedure to run the excellent smart indenter. To do this I'm trying to use sendkeys. The keys I'm using to run the indenter are Ctrl+Shfit+p. The string I'm using for sendkeys is "^(+p)". And.... It doesn't seem to work. No alteration of the procedure I'm running it on. I have the sendkeys in a procedure in an add in. To try and run it in another project I'm opening the Macros menu, changing the Macros In drop down to show the ones in the add in and running it.
If I change the sendkeys string to "+p" it goes ahead and inserts an upper case P so it would appear that the problem is trying to do a Ctrl and Shift at the same time.
Has anyone a solution for this please?
TIA
Lisa
Sendkeys
-
- 5StarLounger
- Posts: 817
- Joined: 24 Jan 2010, 15:56
Re: Sendkeys
Have you tried simply using:
Code: Select all
Application.VBE.CommandBars("Code Window").Controls("&Smart Indent").Controls("Indent &Procedure").Execute
Regards,
Rory
Rory
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: Sendkeys
No.... Just have and it worked!!! Perfect!! You wonderful man!!!
Now I can use that to indent a whole project in one go using the add in form!
I was a bit wary of using sendkeys anyway and after a whole day of looking I'd just started to check out the keyboard APIs.
I use this method to programatically set bookmarks and breakpoints in the add in.
Many thanks Rory.
Hugs
Lisa
Now I can use that to indent a whole project in one go using the add in form!
I was a bit wary of using sendkeys anyway and after a whole day of looking I'd just started to check out the keyboard APIs.
I use this method to programatically set bookmarks and breakpoints in the add in.
Many thanks Rory.
Hugs
Lisa
-
- 5StarLounger
- Posts: 817
- Joined: 24 Jan 2010, 15:56
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: Sendkeys
I've done all that now. I have to upload the latest version which I will do this weekend.
It's available for free on the code cage forum Rory. I thought you were an admin there. Definitely "On the Staff" 'coz I just looked!
Lisa
It's available for free on the code cage forum Rory. I thought you were an admin there. Definitely "On the Staff" 'coz I just looked!
Lisa
-
- 5StarLounger
- Posts: 817
- Joined: 24 Jan 2010, 15:56
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: Sendkeys
Yes.... It's a work in progress but that will always be the case... I'm always tinkering with it and there are always problems to deal with :-(.....
The latest addition... which I want to upload tomorrow... is a new module with procedures built with names that put them at the top of the macro list. These in turn call whatever procedure you want. There's a form with two list boxes to set those up, delete the old procedures and insert new ones in the order you choose. There are a *lot* of procedures in the add in so this saves scrolling down sometimes six or so pages.
Lisa
The latest addition... which I want to upload tomorrow... is a new module with procedures built with names that put them at the top of the macro list. These in turn call whatever procedure you want. There's a form with two list boxes to set those up, delete the old procedures and insert new ones in the order you choose. There are a *lot* of procedures in the add in so this saves scrolling down sometimes six or so pages.
Lisa