+ Reply to Thread
Results 1 to 4 of 4

Command Button in Opening Links

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Manila philippines
    MS-Off Ver
    Excel 2010
    Posts
    113

    Command Button in Opening Links

    Hi,

    I have a file created by my buddy which automatically open multiple links with a delay of 3 seconds of opening in between the links. However, after running the code, I still have to select the range of the links to be opened. Is it possible that the links be opened automatically on a certain table column with 3 seconds delay in between links instead of choosing the range? I have attached the file for your perusal.

    here is the current code.

    Private Sub CommandButton6_Click()

    Dim SelecRng As Range

    Set SelecRng = Application.Selection
    Set SelecRng = Application.InputBox("Range", SelecRng, Type:=8)

    For Each Cell In SelecRng
    Set objShell = CreateObject("Wscript.Shell")
    objShell.Run (Cell)
    Application.Wait (Now + TimeValue("00:00:03"))
    Next


    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Command Button in Opening Links

    May be
    Private Sub CommandButton6_Click()
        Dim objShl  As Object
        Dim rng     As Range
        Dim c       As Range
    
        Set rng = Sheets("Sheet3").Range("C10:C" & Sheets("Sheet3").Cells(Rows.Count, 3).End(xlUp).Row)
    
        For Each c In rng
            Set objShl = CreateObject("wscript.Shell")
            objShl.Run (c)
            Application.Wait (Now + TimeValue("00:00:03"))
        Next c
    End Sub
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Manila philippines
    MS-Off Ver
    Excel 2010
    Posts
    113
    Quote Originally Posted by YasserKhalil View Post
    May be
    Private Sub CommandButton6_Click()
        Dim objShl  As Object
        Dim rng     As Range
        Dim c       As Range
    
        Set rng = Sheets("Sheet3").Range("C10:C" & Sheets("Sheet3").Cells(Rows.Count, 3).End(xlUp).Row)
    
        For Each c In rng
            Set objShl = CreateObject("wscript.Shell")
            objShl.Run (c)
            Application.Wait (Now + TimeValue("00:00:03"))
        Next c
    End Sub
    Thanks for the code! It works perfectly

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Command Button in Opening Links

    You're welcome. Glad I can offer some help
    Please mark the thread as solved

+ 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. [SOLVED] Opening file using a command button click
    By AlexeyY in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2016, 06:53 PM
  2. how to add url links to listbox using command button
    By biznez1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2013, 12:26 PM
  3. Opening a New Workbook with a Command Button.
    By Ortz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-04-2012, 06:05 PM
  4. User form RTE 13 when opening with a command button on a worksheet
    By iaingidley in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-08-2011, 11:50 AM
  5. Command Button Links
    By jespvik in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-28-2009, 09:36 AM
  6. Opening an excel spreadsheet from Command Button
    By cruiser102 in forum Excel General
    Replies: 5
    Last Post: 01-26-2009, 08:09 AM
  7. Opening a file through a command button
    By cooh23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2007, 08:16 PM

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