+ Reply to Thread
Results 1 to 20 of 20

Getting Macros to Run Together (with same range selection as input)

  1. #1
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Question Getting Macros to Run Together (with same range selection as input)

    I am currently trying to get three subroutines to run harmoniously with each other and for some reason or another (my VBA noobness most likely) I can't seem to figure out the call statements correctly, nor am I sure of the best way to pass the selected range and have them run off this range. I've arrived at this point of trying to integrate the pieces of this project together (they successfully and do their job alone) via a lot of help from OnErrorGoto0 within this thread: http://www.excelforum.com/excel-prog...59#post2700959

    The following is the code I'm trying to get to run together, I have them all within a single module and attempt to call the second from the first. The second purely just sends the range to the third. When developing them I would test the second and the third together and the first alone, and both ran successfully. Although the second and the third requiring a few files to be stored locally on your machine for the tag cloud to actually be generated within the web browser.

    Please Login or Register  to view this content.
    I can tell the last subroutine is not being run as I never see the "Macro Finished." So it's more than it just not being passed the range, I believe its not being ran at all. One thing I would like to change is for the first subroutine MakeTable3 to run purely off of whatever range is selected (similar to how the other two subroutines have been written to just run off the selected range)...I'd like to the user to be able to highlight a range and just press play and have the summary sheet appear. Thanks in advance to anyone who has any advice for how I can accomplish this! This forum rocks!
    Last edited by VTHokie11; 02-06-2012 at 04:26 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Getting Macros to Run Together (with same range selection as input)

    Have you tried stepping through each line to see where there is a miss?
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Getting Macros to Run Together (with same range selection as input)

    It should be

    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    before the Exit Sub.
    Good luck.

  4. #4
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    So stepping through as I'd like doesn't seem possible because it keeps giving me a message "Can't enter break mode at this time." I put a stop at the end if right before I construct the web browser but as soon as I step through to the following lines it forces me to run it all in one clean swoop.

    Running the code however now produces a slightly different problem with the following: "Object doesn't support this property or method." Not sure why this is or what it means really. Confused because when I had the web browser prebuilt on a sheet it didn't complain at all. I looked into the name that the created macro created WebBrowser takes on and its still "WebBrowser1," so it can't be a naming issue or at least I don't think. Thanks in advance for any help / advice!

    On a lesser not is there a way to get the first subroutine to run off of whatever range is highlighted rather than having to respond to the application input box? (priority is first figuring out the object doesn't support this property or method issue)

  5. #5
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Getting Macros to Run Together (with same range selection as input)

    Please Login or Register  to view this content.
    Can't answer the rest as I'm not sure what the question is.

  6. #6
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    OEGO thanks for yet another response , glad it is the second question that confused you and not the first as the first had me very nervous that code which uses the WebBrowser may work.

    With respect to your response I was wondering where should I place that 'Set wordcloud = Selection.' I tried a few places but could not get it to work out.

    With respect to the "lesser note" from my previous post I would simply like to stop using the prompt for the user to select a range to run the code off of. I think that's just one more unnecessary click for the user, and it would be better if they could simply highlight the range and run it. Please let me know if that doesn't make since, but also I'd like to worry about this later as getting the WebBrowser portion of the macro to work is much more important

  7. #7
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Getting Macros to Run Together (with same range selection as input)

    I was actually addressing the second part, but got the variable name wrong. Replace
    Please Login or Register  to view this content.
    with just
    Please Login or Register  to view this content.
    I would also replace
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    Thank you so much for that, I should have been able to figure that run off selection out. I don't really know where to start "Object doesn't support this property or method" problem.

    I hope/think it should be possible as the tag cloud generating subroutine (the third subroutine called WordCloud) works when its used in isolation and prints to a WebBrowser already present on a sheet. I tested that portion of my code by having a sheet named "Cloud" that had a WebBrowser already on it

    Please Login or Register  to view this content.
    But now trying to incorporate it with the frequency creation subroutine "MakeTable3" it's telling me "Object doesn't support this property or method." But I know it does support it! Anyhow thanks again in advance for any help this forum is a life saver...can't wait to be done with this little tool and its so very close at this point.

  9. #9
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Getting Macros to Run Together (with same range selection as input)

    At the time you try to run the code, that control does not exist, so the compiler won't like it. You will need something like
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    I'll try adding the construction earlier but the browser isn't used until the third subroutine and I have it being constructed at the end of the first. I'll report back in a little with good results hopefully. Fingers crossed.

    Edit: Ah hah I replaced 'With Sheets("Incident Summary").WebBrowser1' with the line you provided me and I did not get that message. My tag cloud was blank however but in my experience fiddling with that subroutine that was usually because it was passed nothing as the range...going to start fiddling with that now but have other work with a nearer deadline so may have to wait til the AM.

    Edit II: OK so I have had some time to return to this. What is currently happening is that when I run the code before my tag cloud appears I must turn design mode on then off.

    For some reason after I do this my tag cloud will appear...very odd. When I try to record myself clicking the design mode button twice I get nothing recorded. Also worth mentioning is that the vertical scroll bar typically on the right hand side of a WebBrowser control appears with the tag cloud...i.e. is not visible then upon entering/exiting design mode it appears as well.

    The "Macro Finished." message is also not appearing leading me to believe its still doing something with the construction of the WebBrowser...not really sure on this one any help would be awesome!
    Last edited by VTHokie11; 02-13-2012 at 11:41 AM.

  11. #11
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Getting Macros to Run Together (with same range selection as input)

    What happens if you remove the Do...Loop from the webbrowser code?

  12. #12
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    When I remove the Do...Loop by commenting it out as such:

    Please Login or Register  to view this content.
    I get the following message: Object variable or With block variable not set

  13. #13
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Getting Macros to Run Together (with same range selection as input)

    Comment out that line too. Do you get the message box?

  14. #14
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    Which line is "that" line your speaking of? I get the feeling its not finishing with this chunk of the code since it never tells me "Macro Finished." Thanks again for your help .

    Let me know if you'd like me to email you the jscript files that work with this macro...perhaps it'd be easier if you had them so you saw exactly what was happening with respect to the tag cloud and WebBrowser...just let me know.
    Last edited by VTHokie11; 02-13-2012 at 03:51 PM.

  15. #15
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Getting Macros to Run Together (with same range selection as input)

    This line
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    OK, I commented out that one and although it now went through and gave me the "Macro Finished." message to tell me so I still had to click on the design mode button twice (turn design mode on and then off I'm guessing) for my tag cloud to appear...Very odd. I hope it will be possible to figure this out code would be done except for aesthetics at that point :-)...fingers crossed. Thanks again for your response!

  17. #17
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Getting Macros to Run Together (with same range selection as input)

    OK, so that implies that your loop is never finishing for some reason. Try
    Please Login or Register  to view this content.
    (I am doing this from memory so that might not be correct syntax)

  18. #18
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    With that chunk of the macro coded as follows:

    Please Login or Register  to view this content.
    The loop seems to run through as I get the macro finished message but I unfortunately still must double click on the "Design Mode" button for the tag cloud to appear.

    I've also noticed that at some point during this troubleshooting i've done something such that I'm no longer allowed to record macros from this workbook at all (its the whole workbook too i don't get it).

    Edit: This morning when I rebooted and opened the workbook again I can record. But when I record myself clicking on the design mode button twice it does not seem to record anything at all :-(. This is getting frustrating soooo close but yet so far it seems.
    Last edited by VTHokie11; 02-14-2012 at 11:14 AM.

  19. #19
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Getting Macros to Run Together (with same range selection as input)

    Anyone have any ideas? I still can't seem to figure out this little quirk.

  20. #20
    Registered User
    Join Date
    10-26-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    50

    Thumbs up SOLVED Re: Getting Macros to Run Together (with same range selection as input)

    Complete Code:

    Please Login or Register  to view this content.
    The bit the code needed:

    Please Login or Register  to view this content.
    Still have a few tweaks yet to go...one being that it shows more than the top 5 in the frequency table, i'd rather it only summarize the top 5

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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