+ Reply to Thread
Results 1 to 9 of 9

on load, show image in excel userform web components

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    on load, show image in excel userform web components

    Hi all,

    I was looking for a solution that when you open a excel userform that has a web component in it, it will show an image first. When I click a button, it will show a word doc there.
    The second part is working, but I would like to show an image when the userform starts and not just show a blank web component.

    Is this possible? I just did not find nothing at all on the web and in the in the procedure in VBA editor I also don't see nothing that could work.

    Any help is more than welcome ;-)

    Greetings.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: on load, show image in excel userform web components

    In this example image1 is hidden in the sheet1 and will be shown on sheet1 , not in userform
    Private Sub Workbook_Open()
    Application.OnTime Now + TimeValue("00:00:00"), "imageShow"
    End Sub
    
    Sub imageShow()
    With ActiveSheet.Shapes("Image1")
       Itop = .Top
       Ileft = .Left
       .Top = 0
       .Left = 0
       .Visible = True
       Pause = 10
       tnow = Timer
       Do While Timer < tnow + Pause
       DoEvents
       Loop
       .Top = Itop
       .Left = Ileft
       ActiveSheet.Shapes("Image1").Visible = False
    End With
    End Sub
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: on load, show image in excel userform web components

    Hi Patel45,

    I actualy need to show it in the userform, so your example only shows in the sheet?

    greetings.

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: on load, show image in excel userform web components

    attach your file, maybe we can adapt the code for the userform

  5. #5
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: on load, show image in excel userform web components

    Attached is a really great example of some of the things you can accomplish with a web browser. I have set it to open an online Excel logo image. You can change this to a local image. You can also navigate to hotmail, input your username/ password and it will log you in.

    Hope this helps.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  6. #6
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: on load, show image in excel userform web components

    Hi Abousetta,

    Thanks for the great excel file. I was checking it, and it is working. When I tried to copy part of the code that could work. I was getting nowhere. I guess I miss something but no clue. I did copy the below code, but then I was getting error starting from "UpdateURL"

    Option Explicit
    
    'Excel user group page
    Dim HOMEPAGE   As String
    Dim Ready      As Boolean
    Dim StopWatch  As Single
    
    'Private Sub txtaddress_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    
        'LoadPage
    
    'End Sub
    
    Private Sub txtAddress_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    
        txtAddress.SelStart = 0
        txtAddress.SelLength = 99
    
    End Sub
    
    Private Sub UserForm_Initialize()
    
        
    
        HOMEPAGE = "X:\ACL\ACL Netherlands Corporates\Development\Develop\mift\MiftSupportPortal\Image Folder\fondo.jpg"
    
        UpdateURL
        txtAddress = HOMEPAGE
        LoadPage
        txtAddress.SetFocus
    
        Ready = True
    
    End Sub
    
    Sub LoadPage()
    
        WB.Navigate txtAddress.Text
    
    End Sub
    
    
    
    Private Sub cmdHome_Click()
    
        WB.Navigate "X:\SupportPortal\Image Folder\fondo.jpg"
    
    End Sub
    
    
    
    Private Sub WB_DownloadBegin()
    
        StopWatch = Timer
    
    End Sub
    
    Private Sub WB_DownloadComplete()
    
        StopWatch = Timer - StopWatch
    
    
    End Sub
    
    Private Sub WB_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    
        txtAddress = URL
    
    End Sub
    
    Private Sub WB_StatusTextChange(ByVal Text As String)
    
        lblStatus.Caption = Text
    
    End Sub
    
    Private Sub WB_TitleChange(ByVal Text As String)
    
        Caption = Text
    
    End Sub
    Can you please let me know where I went wrong?

    Greetings.

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: on load, show image in excel userform web components

    You could just put an image control over the owc component and then set its visible property to false when the button is pressed
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  8. #8
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: on load, show image in excel userform web components

    Hi JosephP,

    Do you have some sample code so I can have a look how to do this? Many things are still new to me and without examples I'm kind of lost.

    Greetings.

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: on load, show image in excel userform web components

    Once you put the control on the form and add whatever picture you want at design time the only code is
    me.image1.visible = false
    changing the name to match your actual control

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1