+ Reply to Thread
Results 1 to 2 of 2

Chrome shell with variables?

  1. #1
    Registered User
    Join Date
    07-27-2017
    Location
    York, England
    MS-Off Ver
    2010,2013
    Posts
    1

    Question Chrome shell with variables?

    Hi,

    I am trying to resolve an issue where certain websites have to be opened in chrome due network restrictions at work. I'm using the shell argument to create an instance of chrome and open a webpage.

    This works well for fixed addresses like "http://www.google.com", but when I try to put variables in it throws up the file not found error.

    Please Login or Register  to view this content.
    Is it possible to pass variables to the shell argument and if so where am I going wrong? The message box suggests my text arrangement is correct. I have also tried to place the message box text in to a variable and put
    Please Login or Register  to view this content.
    Any help would be greatly appreciated as this is the one of the final pieces of code I have to get right to publish the spreadsheet.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Chrome shell with variables?

    Hi y21leo and welcome to ExcelForum,

    Thank you for using CODE TAGS, it makes answering questions a lot easier. I did not test your code, with the Offsets, but started from the beginning. See the attached file that should help you, with several working examples based on your URL.

    In addition:
    a. The leading/trailing DOUBLE QUOTES are not needed in the URL string (they probably are needed in the MsgBox string) since there are no embedded DOUBLE QUOTES (or embedded SPACES) in the URL.
    b. You might want to replace MsgBox with Debug.Print when doing diagnostic printing. Debug.Print outputs to the IMMEDIATE WINDOW (CTRL G in the debugger).

    Please Login or Register  to view this content.


    It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
    Please Login or Register  to view this content.
    This option requires all variables to be declared and will give a compiler error for undeclared variables.

    The following may help debug your code now and in the future:
    Debugger Secrets:
    a. Press 'F8' to single step (goes into subroutines and functions).
    b. Press SHIFT 'F8' to single step OVER subroutines and functions.
    c. Press CTRL 'F8' to stop at the line where the cursor is.
    d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
    e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
    output to the IMMEDIATE WINDOW.
    f. Select View > Locals to see all variables while debugging.
    g. To automatically set a BREAKPOINT at a certain location put in the line:
    'Debug.Assert False'
    h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
    if i >= 20 and xTV20 > 99.56 then
    Debug.Assert False
    endif
    i. A variable value will be displayed by putting the cursor over the variable name.

    To manually set a breakpoint, see http://www.wiseowl.co.uk/blog/s196/breakpoints.htm

    Lewis
    Attached Files Attached Files

+ 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. Chrome Extension
    By Kyle123 in forum The Water Cooler
    Replies: 81
    Last Post: 06-25-2016, 08:17 PM
  2. [SOLVED] chrome always waiting.............
    By martindwilson in forum Suggestions for Improvement
    Replies: 4
    Last Post: 09-18-2014, 12:20 AM
  3. [SOLVED] Macro to enter variables to Shell Command
    By ussenterprise in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2013, 03:27 PM
  4. Shell - trouble with variables and quotes
    By brl8 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-30-2010, 12:01 PM
  5. Using macro to enter variables to Shell Command
    By Padre in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-12-2009, 05:06 PM
  6. Pass variables value to Shell
    By wpw3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-07-2005, 12:06 PM

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