Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default System Tray Notification/Alert

All:

I have an Excel-based validation application that queries an Oracle db
and exports the recordsets as text files that are imported into Access.
Once imported, the app runs several Access queries that join the newly
imported text files to linked DB2 tables. This, in turn, invokes the
DB2 Security model that prompts for a UserID and password.

The Oracle queries take a variety of different times and I'm looking
for a way to notify the user that the DB2 security model has been
invoked and they need to need to enter their userid and password to
complete the process.

Ideally, I'm looking for a way to manipulate the Excel icon in the
System Tray (API?) similar to how the Outlook icon flashes when you
start to send an e-mail from Excel, but I'm open to other ideas/Alerts.
Here's the code that calls the Access queries. Thanks for any help...

Sub AccessQuery(queryname As String, targetsheet As Worksheet,
outputcell As Range, Optional crng As Range, Optional Header As
Boolean)
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim Time1 As Double

Application.StatusBar = "Query Start Time: " & Format(qTime,
"mm/dd/yyyy h:mm.ss AM/PM;@") & _
" - Running Access Query #: " & AccessQryCounter + 1 & ". Please
wait..."

'// Clear old data
Call ClearOldData(targetsheet, crng)

'// Open the connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
dblocation & ";" & "Jet OLEDB:Database Password=Play123;"
Time1 = Now

'// Open the recordset---DB2 Security model invoked here.
rst.Open queryname, cnn, adOpenForwardOnly, adLockReadOnly,
adCmdStoredProc

If Header = True Then
'// Collect the field names and place them in the worksheet.
For i = 1 To rst.Fields.Count
targetsheet.Cells(outputcell.Row, outputcell.Column - 1 +
i).Value = rst.Fields(i - 1).Name
Next
'// Copy the recordset
targetsheet.Cells(outputcell.Row + 1,
outputcell.Column).CopyFromRecordset rst
Call HdrFormat(targetsheet, outputcell)
Else
'// Copy the recordset without headers
targetsheet.Cells(outputcell.Row + 1,
outputcell.Column).CopyFromRecordset rst
End If

'// Close the recordset and connection
rst.Close
cnn.Close
Call WriteLog(queryname, Time1, Now)

AccessQryCounter = AccessQryCounter + 1
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default System Tray Notification/Alert


Hello Zachary,

Here are the API calls you will need to Flash the Application Title.
The macro Flash is a VBA routine. It should serve as model for you in
creating a suitable function for your needs.


Code:
--------------------

Public Declare Function GetActiveWindow _
Lib "User32.dll" () As Long

Public Declare Function Sleep _
Lib "Kernel32.dll" _
(ByVal dwMillisecs As Long) As Long

Declare Function FlashWindow _
Lib "User32.dll" _
(ByVal hWnd As Long, _
ByVal fInvert As Boolean) As Boolean

'The return value is the state of the window
'(active or inactive) prior to the call

Public Sub Flash()

Dim I As Integer
Dim Status As Long

For I = 1 To 7
Status = FlashWindow(GetActiveWindow(), Not Status)
Sleep (250)
Next I

End Sub

--------------------

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=482351

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default System Tray Notification/Alert

Leith:

Thanks very much. That's just what I needed.

Zachary

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display a message in system tray Vinod Excel Discussion (Misc queries) 0 March 29th 10 02:08 PM
Excel alert/Notification Lise Excel Worksheet Functions 1 March 26th 08 01:33 PM
How to make an alert system by Excel ? Erche DP Excel Programming 1 August 6th 03 01:53 AM
How to make an alert system by Excel ? Erche DP Excel Programming 0 August 5th 03 05:56 AM
How to make an alert system by Excel ? Erche DP Excel Programming 0 August 5th 03 04:57 AM


All times are GMT +1. The time now is 03:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"