Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, its within the same module.
Error I am getting is on text "findWindow" with message Sub or Function not defined |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Xl 2007 v 2003 Re Populate ThisWorkbook via VBA | Excel Programming | |||
Populate ThisWorkbook Q | Excel Programming | |||
Populate ThisWorkbook via Code | Excel Programming | |||
Remove ThisWorkbook code via VBA | Excel Programming | |||
Delete the code in ThisWorkbook | Excel Programming |