I need help with appactivate syntax and more

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
823
See http://www.mrexcel.com/board2/viewtopic.php?t=126515&highlight=

My current macro says:

SendKeys "%{tab}^a^c%{tab}"

And it works, but I have to have the user make sure the target application was the last one open before Excel, otherwise [Alt+Tab] will bring up the wrong screen.

I think I want to use the appactivate command so the target application will come up no matter where it was in the sequence of recent events.

VBA Help examples:

*********

Dim MyAppID, ReturnValue
' In Microsoft Windows:
AppActivate "Microsoft Word" ' Activate Microsoft
' Word.

' AppActivate can also use the return value of the Shell function.
MyAppID = Shell("C:\WORD\WINWORD.EXE", 1) ' Run Microsoft Word.
AppActivate MyAppID ' Activate Microsoft
' Word.

**********

are esoteric and Greek to me.

Can someone help me with the syntax?

Dims, Shell functions and AppIDs are throwing me a curve.

The application I want to open is Lotus Notes, the name I see on the dilog box when I press [Alt+Tab] is "Supplier C.A......- Lotus Notes" The "....." stuff between C.A. and Lotus Notes is going to vary.


Help says:

Syntax

AppActivate title[, wait]

But this
******
AppActivate "Supplier C.A."[, wait]
******
doesn't work
.
.
.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi StACase

I've got Lotus Notes at work :confused: and it is usually installed in a directory called 'notes'. The main file is 'notes.exe', so this works for me

Sub OpenNotes()
Dim appID

appID = Shell("C:\notes\notes.exe", 1)
AppActivate appID
End Sub


Any use?

Regards
 
Upvote 0
Thanks for the response (-:

Results are:

Failed )-:

Run-time error'5':
Invalid procedure call or argument

the last line:
*********
AppActivate appID
*********
was highlighted on the module screen

I checked the pathway and right clicked on the notes application in C:\Notes where you said it would be, selected open and it flashed where minimized on the tool bar but didn't activate.

I removed "AppActivate appID" and the toolbar icon still flashes

I thought maybe the Sendkeys routine might work so I substituted the last line. AppActivate appID with SendKeys "^a^c%{tab}" And it ran, but it selected and copied the Excel sheet I was on and then opened the previous application via [Alt+Tab].

So I'm stuck
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,659
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top