+ Reply to Thread
Results 1 to 2 of 2

Macro to enter variables to Shell Command

  1. #1
    Forum Contributor
    Join Date
    07-19-2012
    Location
    Redmond, WA
    MS-Off Ver
    O365
    Posts
    133

    Macro to enter variables to Shell Command

    This was very helpful. It got me closer to my goal.

    I have several hundred sections with a host name, a macro button, and an IP Address below.

    I have already built out the individual macros but became interested in building only one macro for future use. Really, the only variable is the IP Address and the Macro name. Setting up one macro will remove the macro name.

    Here's what I've tried so far:

    1st
    Please Login or Register  to view this content.
    Doesn't work so far...

    Then:
    Please Login or Register  to view this content.
    This brings up cannot find pingTrue as a command to run (I chuckled...)

    Then:
    Please Login or Register  to view this content.
    This brings up cannot find host True to ping.

    Given that I have several hundred boxes with 3 or 4 different commands (RDP, ping, Putty, etc...) whose only variable is the IP Address 2 cell below the button, is there a way to create a single macro that will ping that IP Address?

    The ranges change per sheet.

    P.S. This is only my 2nd attempt at building out macros...
    Last edited by JBeaucaire; 02-14-2013 at 02:27 PM. Reason: Moved to own thread. PLEASE read the FORUM RULES, link is above in menu bar.

  2. #2
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    31

    Re: Macro to enter variables to Shell Command

    Hi

    I think you're nearly there! It looks like you're calling the 'ping' command ok, but the ActiveCell.Offset(2,0).activate is activating that range and (i think) returning 'True' to indicate that the cell was activated sucessfully. I'd not recommend using activecell in this case as it will vary with the currently selected cell (unless that's what you want!). I'd go with something like

    Please Login or Register  to view this content.
    which will give the value in cell at Row R and Column C (both expressed numerically) allowing loops from row to row. If you did intend the 'activecell.offset' bit, just get rid of '.Activate'.

    I'm not quite sure what you're getting at in the 2nd to last para... can you clairfy?

    Cheers

    Mat

  3. #3
    Forum Contributor
    Join Date
    07-19-2012
    Location
    Redmond, WA
    MS-Off Ver
    O365
    Posts
    133

    Re: Macro to enter variables to Shell Command

    We nailed it down!

    Please Login or Register  to view this content.

+ 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