Posts by aydllan

    Re: Attaching Hyperlink To Dynamically-Created Command Button Within a Userform


    WOW. Now that's what I call elegant.


    I took the suggestion of using classes, resurrecting my old Class code, and I got it to work. After looking at it for a while (I've learned a lot since incorporating it a couple years ago), I understand it a bit better.
    However, the way you've done it is MUCH smoother. I will definitely have to examine this a bit more! I've never done custom Properties, as you have here. I can't say I understand the Let vs. Get; as it appears, it seems to be recursive. I just have to study up some more.


    In my new class/WithEvents code, I just passed the URL for each button using the forms.commandbutton's .Tag property to the Class code.


    Thank you so much for the example, this helps a TON.


    You all rock.

    Re: Attaching Hyperlink To Dynamically-Created Command Button Within a Userform


    I have used classes before, but I cannot claim to understand them fully. I created a class in the past to generate buttons like this before, but for other means, and the way I did it is not exactly applicable AFAIK. If I knew more, maybe that would be the answer, but I'm not educated enough on the subject of Classes to ask the right questions. If I knew how to apply classes for this particular application, I would do it. Perhaps I'll try to figure it out, all the while hoping for a different (yet probably less elegant) solution.


    To answer how hyperlinks would be determined, I read the URLs from the destination from a source, an html-based website (this part is done). What will be created is a list of "Topics" and buttons for editing and updating these topics, but the data resides on a web server elsewhere (make sense?). So the question becomes how to 'deliver' the URLs to the buttons/labels/whatever for the user to click on?

    I am trying to attach a hyperlink (or its equivalent) to a dynamically-created command button (or other clickable object) within a Userform using Excel 2003.


    For clarification, I would like to dynamically create a clickable button that takes you to a specific URL.
    The idea is to have the main code create a list of buttons on a userform (I know how to do this), but each one having its own hyperlink equivalent (for example, clicking on it calls a specific subroutine found elsewhere).


    I can accomplish this with pre-generated buttons, but I cannot seem to do this with dynamically-created ones.


    Any suggestions?


    Thanks for any help you may have to offer.
    (I realized I violated the rules for hijacking a thread, so I created a new thread. My apologies.)

    Re: Attaching Hyperlink To Command Button


    Is there a way to accomplish this with a dynamically-created button/lablel/other clickable item within a Userform?


    For clarification, I would like to dynamically create a clickable button that takes you to a specific URL.
    The main code in general creates a list of buttons on a userform (I know how to do this), but each one has its own hyperlink equivalent (for example, clicking on it calls a specific subroutine found elsewhere).


    I can accomplish this with pre-generated buttons, but I cannot seem to do this with dynamically-created ones.


    Any suggestions?

    I have a large Excel 2003 spreadsheet with macros that I use on my work computer. I attempted to work on this spreadsheet from my home computer (by simply copying it to my home computer), but for some reason I'm having trouble with getting simple code to function. I am using the same version of 2003 at work and at home (well supposedly -- I am using software intended for home-use that was given to me by work IT).


    When I try to run any of the code I get the VBA Error (1004) message on a simple line such as:

    Code
    for i = 1 to 20


    It chokes on the "i" saying it does not have the proper libraries and such. Same thing for the Chr() function!


    So then I tried buildng a new macro in a completely new workbook to test this. In this new workbook, created on my computer at home, the FOR statement and Chr() function work perfectly.


    Can anyone tell me why this might be happening?


    thanks!


    Excel 2003
    WinXP (in both places)

    I have developed a database that is ported to other computer systems. My problem is that I have to hard-code the filename into the VBA code to identify the correct Application Object. I found that if I have activated another spreadsheet and run the code, it performs the actions on the wrong spreadsheet.


    So my question is, is there a way to get the VBA code to automatically associate itself with the file in which it resides? That way, when I move the file to another computer, it knows what .xls file to use as the "Application Object".


    here is what I have now (I replaced the actual paths with {x pathname}):



    When I copy the file to another location, I manually uncomment the correct fname and xlApp name... a real pain, especially if I share this with a large community. I don't want to have to teach everyone how to do this every time!


    thanks for any help you have to offer!

    Re: UserForm Controls (components within MultiPage)


    THANKS to both for your help!


    The last reply didn't exactly resolve my issue directly, but it did get resolved, and now I see how to add items at runtime!
    The difference is stepping through the code (F8) vs running it. When I step through, it doesn't update what's on-screen.


    Your code performed the same as mine so it's not a programming issue necessarily, but an application issue? Perhaps there's a way to see the updates as you step through the code (ref the link to the old thread in my initial post --- "DoEvents" and/or "imgUpdating")?


    I wanted to keep this topic with the old thread so that the person who mentioned these techniques might be able to answer my issue as well since they're related.


    Anyway, thank you very much! I learned something also -- I wasn't using the ...pages.item(x).... either. So now I will.


    Sorry I didn't post my code -- there really isn't much there yet (I hadn't gotten to the point of adding textboxes at runtime yet, since I hadn't resolved this first issue, but now I will!). I was about to post what I had but I wanted to give it one more try first and it worked!


    Thanks again!

    Re: UserForm Controls (components within MultiPage)


    Not sure if I'm understanding you exactly, but I haven't gotten to actually adding textboxes inside the multipage at runtime yet. It was my next step, thinking the first steps would be easy :(


    I have textboxes in one page (of two) at initial setup (userform design phase). The idea would be to add more pages (and therefore more textboxes) after I conquer this problem.


    To follow through with what you're talking about, I tried double-clicking on one of the textboxes in the multipage.

    Code
    Private Sub TextBox8_Change()


    is what it responded with, instead of something like:

    Code
    Private Sub Me.MultiPage1.TextBox8_Change()


    so perhaps part of the problem is the way I'm initiallizing the textboxes? maybe they aren't actually 'linked' to the multipage? (does the word "Parent" apply here?)

    What I'm trying to do:
    Create a "search" userform that pulls data from a spreadsheet of raw data (hardware specs) and organizes it into a multipage control. Each page of the MultiPage has a different piece of hardware with simliar data entry categories (height, weight, calibration date for example).
    Each page at the moment contains labels and textboxes only. The idea is to place data from the spreadsheet into these textboxes, and create new pages as needed during runtime.


    My current issues:
    Just for testing/debugging, I have a "_Change()" code that is triggered by changing pages within the Multipage. When I run the control, I trigger the change, but the textboxes and labels disappear.


    I'm VERY new to MultiPage controls, and only a little more knowledgeable about other controls. Any help is appreciated! If anyone has any better way of doing this, ALL suggestions are welcome!!


    I don't have much code to show, other than basic _Change() structure containing a msgbox for debugging.




    This is related to a locked thread, where "imgUpdating" and "DoEvents" were referenced. I tried DoEvents, without success. I also don't know what "imgUpdating" is, but it sounds like it helped the other person with a similar issue:


    http://www.ozgrid.com/forum/showthread.php?t=29188


    Thank you for any help you might have to offer!
    Aydllan

    Re: UserForm Controls not displaying at runtime



    This is helpful, but I'm still confused. I'm having very similar problems.


    I have a userform with a multipage contained within. On the first page, I have several textboxes that will contain info gathered from the spreadsheet.


    I'm running a _Change() code with this as a test case, which is supposed to add more pages and whatnot, but when I start the userform, I change the page from pg 1 to 2 (to trigger the _Change), back to page 1 to see if the textboxes are still there, but all the textboxes have disappeared.


    So as it seems, I can't change from one page within the multipage to another without data disappearing.


    I tried the "DoEvents" thing, but that didn't work.


    I don't know what "imgUpdating" is. Can't find a reference to that method/property anywhere.


    ideas?