Excel VBA - VBA Equivalent of hWnd property


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Excel VBA - VBA Equivalent of hWnd property

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666

    Excel VBA - VBA Equivalent of hWnd property

    I want to use the About Box API, which requires passing the hWnd of the calling form. In VB6, I would do
    Code:
    Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" _
    (ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, _
    ByVal hIcon As Long) As Long
    
    Private Sub mnuAbout_Click()
    ShellAbout Me.hWnd, "My Program", "Another fine product from HackWare", ByVal 0&
    End Sub
    I did some Googling, and found what I thought would be the answer in Application.ActiveWindow.Hwnd. However, when I run this, I get an "Object Does Not Support This Property Or Method" run time error.
    Code:
    ShellAbout Application.ActiveWindow.hwnd, "Main Menu", "Another fine product from HackWare", ByVal 0&
    So, for Excel VBA, what would I use as the hWnd of the spreadsheet (no userform in this project).
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  2. #2
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    Have you tried this:
    Code:
    ShellAbout Application.hwnd, "Main Menu", "Another fine product from HackWare", ByVal 0&

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Ok, that worked, but why did it work?

    What is the difference between Application.ActiveWindow.hwnd and Application.hWnd
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  4. #4
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    Easy, there is no hwnd property for ActiveWindow
    At least according to the Intellisence list.

  5. #5
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Quote Originally Posted by Ron Weller
    Easy, there is no hwnd property for ActiveWindow
    At least according to the Intellisence list.
    You are right.

    Well, that is the last darn time I'm going to believe something I find on a Google search.

    Thanks again.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Replies: 0
    Last Post: 05-15-2008, 05:24 PM
  2. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 11:40 PM
  3. Re: App Object (fixes)
    By Rob Teixeira in forum .NET
    Replies: 129
    Last Post: 06-06-2002, 06:23 AM
  4. App Object
    By Rob Teixeira in forum .NET
    Replies: 15
    Last Post: 05-31-2002, 04:30 PM
  5. Usercontrol's never been terminated
    By Rattagarn V. in forum VB Classic
    Replies: 5
    Last Post: 10-09-2000, 08:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center