|
-
Sep 28th, 2004, 11:45 AM
#1
Thread Starter
New Member
VBA - VB.Net - Integrating
Hi, I need assistance on how I could have VBA currently running in Excel to notify events to a VB.Net system.
VBA code is continuosly processing data. My idea is to modify it in a way that, under given circumstances, it would post/queue something to a VB.Net "listener" which would then take action.
If I am not clear enough, please let me know.
Thanks in advance
Diego
Last edited by dvillecco; Oct 5th, 2004 at 10:53 PM.
-
Oct 5th, 2004, 05:31 PM
#2
One way (I'm sure there are a few) would be in VBA to write some
code to output a text file or something to a directory whe
something meets your criteria. Then in VB.NET write some code to
watch this folder for the change event. Then when that happens
you could read in the file, then dispose of it, do something based
on the file contents and wait for the next file.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 5th, 2004, 06:23 PM
#3
Thread Starter
New Member
MSMQ
Hi, In the meanwhile, I have been doing some research in the microsoft's knowledge base and, although I have never used it, I thought of the idea of using MSMQ.
Don´t know yet if this would be the right approach but the problem with text files or that kind of stuff is that, for the problem I need to solve, I will need many many transactions/messages to be sent from VBA to .Net very fast and also to manage a sort of priority message queues.
I´ll keep researching but so far, I find MSMQ the most adequate way to send messages from VBA to be watched by .Net and perform actions.
Would VSTO help in any way for this?
Thanks
Diego
-
Oct 5th, 2004, 06:42 PM
#4
Since you have allot of transactions you could also use SendMessage
API to your VB.NET application. Easier than message queueing.
You can send the messages to a bunch of different textboxes
or ??? Each for a specific category from your Excel VBA.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 5th, 2004, 07:11 PM
#5
Thread Starter
New Member
API
How would that be? I mean, can you give me some sample code as to send a message from VBA using that API?
Thx
-
Oct 5th, 2004, 08:31 PM
#6
Here are the basic APIs you will need. You may need more, like
for subclassing depending on how your transaction are and
frequency. Its not too hard to setup. Try a search or the API FAQ
for a better understanding.
VB Code:
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|