![]() |
ThisWorkbook populate with Code Q
Would anyone know what the part-code below debugs at "FindWindow" -
I'm using Excel 2007 and code worked perfectly in 2003 Sub Populate_TW() Dim StartLine As Long Dim msg1 As String, msg2 As String Dim VBEHwnd As Long On Error GoTo ErrH: Application.VBE.MainWindow.Visible = False VBEHwnd = FindWindow("wndclass_desked_gsk", _ Application.VBE.MainWindow.Caption) If VBEHwnd Then LockWindowUpdate VBEHwnd End If ....... ........ End Sub |
ThisWorkbook populate with Code Q
That looks like some of my code. What sort of problem are you having?
Exactly what error messages do you receive? The code works fine for me in Excel 2007. Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Mon, 26 Jan 2009 09:31:29 -0800 (PST), Seanie wrote: Would anyone know what the part-code below debugs at "FindWindow" - I'm using Excel 2007 and code worked perfectly in 2003 Sub Populate_TW() Dim StartLine As Long Dim msg1 As String, msg2 As String Dim VBEHwnd As Long On Error GoTo ErrH: Application.VBE.MainWindow.Visible = False VBEHwnd = FindWindow("wndclass_desked_gsk", _ Application.VBE.MainWindow.Caption) If VBEHwnd Then LockWindowUpdate VBEHwnd End If ...... ....... End Sub |
ThisWorkbook populate with Code Q
It sure is Chip, probably all of it. I have used it successfully with X
\l 2003 but since I upgraded to XL 2007 it hasn't worked. It debugs on "FindWindow" and I don't know why as I haven't changed any of the code. Two things I remember that were required for it to work on 2003 was Trust Access to the VBA object and a reference within VB to MS VB extensibility. I've confirmed both are checked but I get this error |
ThisWorkbook populate with Code Q
Is the FindWindow API declared and available in your for use in module
but why not simply VBEHwnd = Application.VBE.MainWindow.Hwnd Regards, Peter T "Seanie" wrote in message ... Would anyone know what the part-code below debugs at "FindWindow" - I'm using Excel 2007 and code worked perfectly in 2003 Sub Populate_TW() Dim StartLine As Long Dim msg1 As String, msg2 As String Dim VBEHwnd As Long On Error GoTo ErrH: Application.VBE.MainWindow.Visible = False VBEHwnd = FindWindow("wndclass_desked_gsk", _ Application.VBE.MainWindow.Caption) If VBEHwnd Then LockWindowUpdate VBEHwnd End If ...... ....... End Sub |
ThisWorkbook populate with Code Q
Below, exactly as in my 2003 workbook, which worked
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal ClassName As String, ByVal WindowName As String) As Long Private Declare Function LockWindowUpdate Lib "user32" _ (ByVal hWndLock As Long) As Long |
ThisWorkbook populate with Code Q
That looks fine assuming of course you are calling the APIs from within the
same module. You didn't answer Chip's question about what error you get. Did you try reading directly as I suggested - VBEHwnd = Application.VBE.MainWindow.Hwnd (even in Excel97) Regards, Peter T "Seanie" wrote in message ... Below, exactly as in my 2003 workbook, which worked Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal ClassName As String, ByVal WindowName As String) As Long Private Declare Function LockWindowUpdate Lib "user32" _ (ByVal hWndLock As Long) As Long |
ThisWorkbook populate with Code Q
Yes, its within the same module.
Error I am getting is on text "findWindow" with message Sub or Function not defined |
ThisWorkbook populate with Code Q
Head the module containing the APIs and the code 'Option Explicit' and do
Debug / Compile. It will probably blow in the same place. What is your OS, 64 bit per chance (not that I could say why that should matter) Third time, have you tried returning the hWnd directly from MainWindow as suggested. Regards, Peter T "Seanie" wrote in message ... Yes, its within the same module. Error I am getting is on text "findWindow" with message Sub or Function not defined |
All times are GMT +1. The time now is 01:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com