Results 1 to 5 of 5

Thread: [RESOLVED] UserControl with custom Property Page

  1. #1

    Thread Starter
    Addicted Member Davor Geci's Avatar
    Join Date
    Sep 2009
    Posts
    224

    Resolved [RESOLVED] UserControl with custom Property Page

    Hello.
    I'm having a simple usercontrol with 1 custom property page. Is there a way to programmatically open this property page when I create this control on a form?

    Thnx, Davor
    My projects:
    Virtual Forms
    VBA Telemetry

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: UserControl with custom Property Page

    This seems to work:

    Code:
    Private Sub UserControl_InitProperties()
        If Not Ambient.UserMode Then CreateObject("WScript.Shell").SendKeys "+{F4}"
    End Sub
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3

    Thread Starter
    Addicted Member Davor Geci's Avatar
    Join Date
    Sep 2009
    Posts
    224

    Re: UserControl with custom Property Page

    Hello Bonnie West,
    Thank you for your post. This works great in vb6. But doesn't work if I compile ocx and use it in Office (for example Excel).
    Is there any solution for using this in office to pop up property page?
    My projects:
    Virtual Forms
    VBA Telemetry

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: UserControl with custom Property Page

    That simple code basically just presses the VB6 IDE's shortcut key (Shift+F4) for displaying the Property Pages dialog box of the currently selected object. If Excel and other MS Office apps have an equivalent shortcut key, use them instead. You are probably going to have to figure out a way of determining your UC's host if you want a solution that works in all situations.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  5. #5

    Thread Starter
    Addicted Member Davor Geci's Avatar
    Join Date
    Sep 2009
    Posts
    224

    Re: UserControl with custom Property Page

    Thank you Bonnie West.
    The simplest solutions are always the best. It is not difficult to complicate, but it is difficult to make a complicated thing in a simple way.
    My projects:
    Virtual Forms
    VBA Telemetry

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width