Posts by Joe Derr

    Thanks for everyones help so far..

    Question: I have Userforms that are displayed by Command Buttons when clicked hides one and shows another

    Private Sub CommandButton2_Click()
    End Sub

    Problem is, else where in the program I have a Maintenance Menu that sets a "maintenance value" to off or on, I have the following code used in the UserForm_Initialize that fires the first time a UserForm loads, but doesnt fire again if the page is re-displayed.

    Private Sub UserForm_Initialize()
    ' Added Maintence Option for use in TroubleShooting - 3/2/02
    MaintOption = Worksheets("Data").Cells(1, 13).Value
    If MaintOption = "On" Then
     CommandButton4.Caption = "Test Info"
    ElseIf MaintOption = "Off" Then
     CommandButton4.Caption = ""
     CommandButton4.Enabled = False
      End If
    End Sub

    If I change the Maintenance Option from Off to On, and I have already been on that page, I need the Button to be displayed and same goes if I have already been to the page, see I forgot to turn on the maintenace option, go back turn it on, It won't display the button still, the UserForm_Initialize doesn't fire again..

    Any ideas on what to change ?

    Re: Load Picture into Userform

    Hi Dave,

    I spent all day yesterday working on the solution and I got it to work in the end. Just for the record, and incase someone else is looking to do this, I am going to post the code that works for me..

    - My sheet is called Logo
    - Its using Stephen Bullens PastePicture mod
    - You can set the image size to the size of your image control so you dont
    - Have to resize the image.

    Re: Load Picture into Userform

    Yes, it will be different images.. The images can reside anywhere on the persons computer who is using the Application. The application isn't even in any set folder...

    For all intents and purposes, the image is a logo of sorts.

    The image once loaded will be the only one used, but the same application is to be used by other sections, ie other logo's.

    This project started out as a way for me to order parts for the company, and then when others seen it, they all want to use it, but since my logo is different than theirs, they want their logo image instead of mine.. so now I am trying to figure out a way to do it with out having to manually go into the code to change it for them..

    So I need for them to browse to their image, and have it loaded onto the sheet in a fashion simular to the one I have shown, so it will be saved on the sheet. I think putting the code for the Paste Picture works, but I will probably have to move it to the Initalization part.. not sure.. unless there is a way to set the image on userform load or something ??

    I have been reading and trying out alot of functions and I just can't seem to put them all together.

    What I am looking to do, is have someone browse to a picture, select it, set it to a sheet, then every time the app is ran, load the image from the sheet.

    I have seen how to load it from a set location (this won't work because it could be anywhere the user saved the picture at, and the picture could be named anything)

    myDocument.Shapes.AddPicture _
    "C:\Somepath\ThePicture.jpg", _
    True, True, 1, 1, 150, 150

    This does great to get the image on the sheet.. but I need to browse to rather than have it hard coded...

    Then... using Stephen Bullens pastepicture function.. I can get the image to the image control

    ActiveSheet.Shapes("Picture 1").CopyPicture xlScreen, xlBitmap
    'Paste the picture from the clipboard into our image control
    Image1.Picture = PastePicture(xlBitmap)

    But it wont save with the app.. so thats why I think it would have to be loaded onto a sheet and then called from on a user_form_initalize right?

    So the question in the end is....

    How do I browse to an image to load it to a worksheet, then is userform_initalize the right way to go to load it from the sheet every time ?