A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Sending keys from vb.2005 to Outlook



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 1st 06, 12:40 AM posted to microsoft.public.outlook.program_forms
Al Christoph
external usenet poster
 
Posts: 1
Default Sending keys from vb.2005 to Outlook

Please forgive me if this is the incorrect forum and direct me to the corret
place.

1. I am developing in VS 2005 / VB. Target is a variety of generations of
Outlook. (I think the folk paying the bill are several major releases back.)
Hence, VSTO is out of the question. And the PIA's are too because the
customer sends the software around the world without charge.

2. The customer wants only one outlook window open on the desk top. He may
be anywhere in Outlook when I need to tell it what to do.

3. Here is the current code that half works - I get the Outlook window
activated but my sendkeys doesn't seem to do anything.
Suggestions please?

Private Sub go(ByVal shortname As String, Optional ByVal params As
String = "", Optional ByVal keys As String = "")
Dim procs() As Process = Process.GetProcessesByName(shortname)
If procs.Length 1 Then
MsgBox(String.Format("You have more than one instance of {0}
running.", shortname))
Exit Sub
ElseIf procs.Length = 1 Then
' switch to that window
Me.TextBox1.Text &= "Activating " & shortname & keys & vbCrLf
AppActivate(procs(0).Id)
If keys "" Then
System.Windows.Forms.SendKeys.Send(keys)
End If
Else
Me.TextBox1.Text &= "Starting" & shortname & " " & " " & params
& " " & keys & vbCrLf
Process.Start(shortname, params)
If keys "" Then System.Windows.Forms.SendKeys.Send(keys)
End If
End Sub
Private Sub bActivate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bActivate.Click
Select Case ComboBox1.SelectedItem.ToString
Case "Windows Address Book" : go("wab")
Case "Outlook" : go("OUTLOOK", "/select outlook:contacts",
"%GC") ' Alt G +A should give me the contacts
End Select
End Sub

I'd be open to creating an outlook application internally and using that if
it did the job and did not require VSTO and anything besides Framework 2.0 on
the customer side.

--
Regards,

Al Christoph
Senior Consultant and Owner
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
A Microsoft Certified Partner (ISV)
Working on utilities for Windows Mail for Vista.

  #2  
Old May 1st 06, 06:18 PM posted to microsoft.public.outlook.program_forms
Al Christoph
external usenet poster
 
Posts: 1
Default Sending keys from vb.2005 to Outlook

This has been resolved. All that was needed was a slight delay before
sending the keys.

More to the point there were far better ways involving the careful use of
command line switches to accomplish my ends without doing a sendkeys.

Regards,
Al
"Al Christoph" wrote in message
...
Please forgive me if this is the incorrect forum and direct me to the
corret
place.

1. I am developing in VS 2005 / VB. Target is a variety of generations of
Outlook. (I think the folk paying the bill are several major releases
back.)
Hence, VSTO is out of the question. And the PIA's are too because the
customer sends the software around the world without charge.

2. The customer wants only one outlook window open on the desk top. He may
be anywhere in Outlook when I need to tell it what to do.

3. Here is the current code that half works - I get the Outlook window
activated but my sendkeys doesn't seem to do anything.
Suggestions please?

Private Sub go(ByVal shortname As String, Optional ByVal params As
String = "", Optional ByVal keys As String = "")
Dim procs() As Process = Process.GetProcessesByName(shortname)
If procs.Length 1 Then
MsgBox(String.Format("You have more than one instance of {0}
running.", shortname))
Exit Sub
ElseIf procs.Length = 1 Then
' switch to that window
Me.TextBox1.Text &= "Activating " & shortname & keys & vbCrLf
AppActivate(procs(0).Id)
If keys "" Then
System.Windows.Forms.SendKeys.Send(keys)
End If
Else
Me.TextBox1.Text &= "Starting" & shortname & " " & " " & params
& " " & keys & vbCrLf
Process.Start(shortname, params)
If keys "" Then System.Windows.Forms.SendKeys.Send(keys)
End If
End Sub
Private Sub bActivate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bActivate.Click
Select Case ComboBox1.SelectedItem.ToString
Case "Windows Address Book" : go("wab")
Case "Outlook" : go("OUTLOOK", "/select outlook:contacts",
"%GC") ' Alt G +A should give me the contacts
End Select
End Sub

I'd be open to creating an outlook application internally and using that
if
it did the job and did not require VSTO and anything besides Framework 2.0
on
the customer side.

--
Regards,

Al Christoph
Senior Consultant and Owner
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
A Microsoft Certified Partner (ISV)
Working on utilities for Windows Mail for Vista.



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I update the calendar in Outlook past 2005? Max Outlook - Calandaring 3 April 15th 06 12:21 AM
shortcuts keys in Outlook David Sherman Outlook - General Queries 1 March 18th 06 12:22 AM
getting E_NOINTERFACE trying to create outlook.application in vc++ (2005) on xp [email protected] Add-ins for Outlook 2 February 17th 06 06:18 PM
how do i add holidays in Outlook beyond 2005 ? Larry Outlook - Calandaring 1 January 17th 06 01:18 PM
Telephony registry keys are missing or damaged? MichaelNJ Outlook - Using Contacts 1 January 12th 06 11:38 AM


All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.