+ Reply to Thread
Results 1 to 7 of 7

Dialogue prompt required when running macro.

  1. #1
    Forum Contributor
    Join Date
    08-23-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    128

    Dialogue prompt required when running macro.

    I have recorded a macro which put simply, goes to a website, takes the information from the page, puts it into a spreadsheet and formats it.
    The site address is like this: \\website.com\Amber\Documents\File-215.htm
    The bold above are the 2 factors which will change.
    Ideally, I would like to press the macro button and a dialogue box with 2 elements appear. One with a dropdown(?) which will allow me to change the amber string. So Green, Amber or Red. The second part, 215, would be an input box, so I could enter 3 digits myself.
    Upon pressing the button I could select green and type in 332, so the file it tries to grab would be:

    \\website.com\Green\Documents\File-332.htm

    Obviously I have had to change the actual url for security reasons and my job longevity.

    Here is what I currently use:

    Please Login or Register  to view this content.
    Majority of it is taken up with formatting. But any help on this would be amazing. Currently I have 3 sets of buttons (Green/Amber and Red) for site 215 and then I have to copy the macro over again and again for other sites. Buttons, buttons everywhere.
    Last edited by X82; 11-17-2015 at 03:13 AM.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Dialogue prompt required when running macro.

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-23-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    128

    Re: Dialogue prompt required when running macro.

    Wow, that looks like it is working great. One thing however, I stupidly left out a vital bit of information.
    While the Amber and site does change depends on the user input, I need it to import 3 files with one press instead of one.
    At the moment it will look for
    "\\website.com\" & x & "\Documents\"

    But for our reports we need 3 files, located in the following locations. The first one, Documents is perfect. There is also another but not in a directory (same naming structure) and a third for recycle bins. Here is the file layouts:

    Please Login or Register  to view this content.
    Sorry, I forgot this information previously. I could just duplicate the macro 2 more times and tweak it myself, but I was hoping for an all in one solution.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Dialogue prompt required when running macro.

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-23-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    128

    Re: Dialogue prompt required when running macro.

    THanks for that.
    However the macro does error
    It will say the document File-215.html is already open when it gets to the line:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Dialogue prompt required when running macro.

    That's what I thought you were asking for in Post #3 to open those additional files by macro?

  7. #7
    Forum Contributor
    Join Date
    08-23-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    128

    Re: Dialogue prompt required when running macro.

    After using your initial code, a lot of googling and some guess work, I managed to make a script which does everything I need.
    1. It takes all 3 html files
    2. Copies only the areas I want
    3. Opens a blank pre-formatted excel sheet
    4. Pastes that into the correct tab and cell
    5. applied some formatting to the pasted text
    6. closes all other files
    7. and saves the blank file as a new file, appending the filename with the date and site number.


    I know it is probably a complete mess, code wise and a lot can be tweaked and trimmed, but for a first go, I'm happy with it.

    Please Login or Register  to view this content.
    In an ideal world, I would like a form to pop up, rather than an input box, where is a dropdown for the colours and an area to input the 3 digit code, with an GO and cancel button. Currently if I run the script and wish to come out, I have to cancel out of errors etc. Not an issue for me but if I want to hand it to the troop here, it will be a headache.
    Last edited by X82; 11-20-2015 at 04:29 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. running vba outlook macro from cmd line prompt
    By craigm2 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 04-06-2015, 11:02 AM
  2. Query regarding dialogue box when running a macro
    By stephen.m.brown in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2014, 12:01 PM
  3. [SOLVED] Adding a dialogue box/prompt to a macro assigned button
    By Clarkit in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-02-2014, 12:32 PM
  4. Don't want a pasword prompt on running macro's
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2012, 06:38 AM
  5. [SOLVED] Unwanted prompt when running auto_open macro
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2012, 01:40 AM
  6. [SOLVED] Running macro x # of times with a prompt
    By Redskinsfan in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-08-2006, 01:50 PM
  7. VB select OK from a prompt when running a macro
    By Stig in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2006, 11:40 AM

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