Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

VBA code to open the insert object and bring you to the browse point

Discussion in 'Information Technology' started by MartinR, Jul 28, 2006.

  1. MartinR

    MartinR
    Expand Collapse
    Guest

    instead of right clicking and scrolling down the list and then clicking
    on insert object and following the steps, is there code that i can put
    behind a button that will bring me directly to the browse part of the
    insert object screen?

    Any suggestions?
     
  2. Loading...

    Similar Threads Forum Date
    Introducing The Spn Code Of Forum Etiquette Announcements Feb 20, 2016
    UK Sikh 'code of silence' on sexual grooming Breaking News Sep 2, 2013
    Can a Dress Code Bar Ethnic and Religious Attire Based on Customer Preferences in the US? Questions and Answers May 3, 2011
    Pacific Code Exempts Religious Drivers (Fiji) Breaking News Feb 16, 2011
    Controversial Gurdwaras 'Breaking the Sikh Code' on Meat and Alcohol Hard Talk Dec 2, 2010

  3. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

    Hi, Martin.

    > is there code that i can put
    > behind a button that will bring me directly to the browse part of the
    > insert object screen?


    Yes. Try:

    Private Sub InsertBtn_Click()

    On Error GoTo ErrHandler

    Me!frameOLEObj.SetFocus
    SendKeys "%F%B", False
    RunCommand acCmdInsertObject

    Exit Sub

    ErrHandler:

    If (Err.Number = 2501) Then ' User cancelled.
    ' Do nothing.
    Else
    MsgBox "Error in InsertBtn_Click( ) in" & vbCrLf & _
    Me.Name & " form." & vbCrLf & vbCrLf & _
    "Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
    End If

    Err.Clear

    End Sub ' InsertBtn_Click( )

    .. . . where InsertBtn is the name of the button and frameOLEObj is the name
    of the control bound to the OLE object column.

    HTH.
    Gunny

    See http://www.QBuilt.com for all your database needs.
    See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    info.


    "MartinR" <martin.ryan@esbi.ie> wrote in message
    news:1152194012.877109.262630@75g2000cwc.googlegroups.com...
    > instead of right clicking and scrolling down the list and then clicking
    > on insert object and following the steps, is there code that i can put
    > behind a button that will bring me directly to the browse part of the
    > insert object screen?
    >
    > Any suggestions?
    >
     
  4. MartinR

    MartinR
    Expand Collapse
    Guest

    When i put that code in and changed the names to the same as on my
    form, i am getting a message saying

    "The command or action 'Insert object' isn't available now"

    What might be wrong?
     
  5. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

    Hi, Martin.

    > What might be wrong?


    Is the control a bound object frame? Is the bound object frame enabled and
    not locked? Is this frame bound to a column with a data type of OLE Object?
    These are the default properties of the control needed to insert objects on
    a form, and they are all requirements for the suggested code to work, so
    don't change these defaults.

    HTH.
    Gunny

    See http://www.QBuilt.com for all your database needs.
    See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    info.


    "MartinR" <martin.ryan@esbi.ie> wrote in message
    news:1152198558.071577.72550@a14g2000cwb.googlegroups.com...
    > When i put that code in and changed the names to the same as on my
    > form, i am getting a message saying
    >
    > "The command or action 'Insert object' isn't available now"
    >
    > What might be wrong?
    >
     
  6. MartinR

    MartinR
    Expand Collapse
    Guest

    all those settings are correct, but i am still getting the same
    message.

    can you also please tell me what the line SendKeys "%F%B",
    False does?
     
  7. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

    Hi, Martin.

    > all those settings are correct, but i am still getting the same
    > message.


    Perhaps it's one of those things that only works in some versions. It works
    with Access 2003 SP-1.

    > can you also please tell me what the line SendKeys "%F%B",
    > False does?


    It's the equivalent of pressing <ALT><F> and then <ALT><B> and not waiting
    for further user input.

    HTH.
    Gunny

    See http://www.QBuilt.com for all your database needs.
    See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    info.


    "MartinR" <martin.ryan@esbi.ie> wrote in message
    news:1152606873.586497.110790@s13g2000cwa.googlegroups.com...
    > all those settings are correct, but i am still getting the same
    > message.
    >
    > can you also please tell me what the line SendKeys "%F%B",
    > False does?
    >
     
  8. MartinR

    MartinR
    Expand Collapse
    Guest

    that worked thanks
     
  9. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

Share This Page