+ Reply to Thread
Results 1 to 27 of 27

Visit Site Address Macro

  1. #1
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Lightbulb Visit Site Address Macro

    I need some tips. I want a macro that


    1. Visit a internet site whose address is the value of a specified cell.

    2. (When this adress is visited, the site automatically changes the adress.)

    3. Then copy the new address from the site a paste it on a specified cell.


    =============================

    The macro should apply only to the cell range F2:F4002 (already given adress) and paste new adress in cell range B2:F4002.



    Any ideas on how to do this??
    Last edited by Drus; 01-30-2011 at 05:56 PM.

  2. #2
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Adress Macro

    *Sigh*

    I hope this is an easy code to create, cause I am total noob at this.

  3. #3
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    I have included the excel worksheet im working with.
    Attached Files Attached Files
    Last edited by Drus; 01-29-2011 at 12:13 AM.

  4. #4
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    I am trying this code but it appears something is wrong, something is not working, it is colored red:

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 01-28-2011 at 09:21 PM. Reason: Added Code Tags

  5. #5
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    Hmmm... I found this other code for running url with macro:...
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 01-28-2011 at 09:22 PM. Reason: Added Code Tags

  6. #6
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    The latest code works:

    Please Login or Register  to view this content.


    However I would like this information: "http://www.microsoft.com" be substituted by placing a the value of a specified cell.

    I have investigated this far:


    Macros: Getting Cell Information

    Invariably, macros written for use within the Calc application will need to access the contents of the cells on a spreadsheet. This tip is an introduction to the various available methods.

    The three methods we will look at are getCellByPosition, getCellRangeByPosition and getCellRangeByName

    The function that is first encountered for most people is getCellByPosition. In the sample below, we access cell A1 (on Sheet1)

    Please Login or Register  to view this content.

    The second example shows the use of getCellRangeByName and may be easier to use - because the cells are referenced by the traditional column/row identifiers that are displayed along each axis. However, for applications requiring looping through an array of cells, getCellByPosition is easier to use.

    Please Login or Register  to view this content.

    The next example shows how getCellInfo grabs an array of cells - myTable. A subsequent call to getCellByPosition for the myTable object is relative to the origin of this array.

    Please Login or Register  to view this content.

    The final method that needs discussion is getCellRangeByPosition and the example below illustrates it's use. It is equivalent in functionality to the previous example.

    Please Login or Register  to view this content.


    I just don't know how to substitute it or add the macro inside the other macro. Any advice?
    Last edited by Drus; 01-29-2011 at 12:49 AM. Reason: New information acquired

  7. #7
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    I found this other code, it should help me dealing with my problem...


    Please Login or Register  to view this content.

    It is supposedly to run another macro from within a macro you need to use the Call statement.
    Last edited by Drus; 01-29-2011 at 01:06 AM.

  8. #8
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    I have tried to replace "http://www.microsoft.com" with the code above, however it appears a message saying "Error, expresion expected".

  9. #9
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    No succes. I really need help

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Visit Site Address Macro

    See if you can adapt this. The .Option(1) is the address returned by the site.

    Please Login or Register  to view this content.
    You might also look at the links.
    Last edited by shg; 01-29-2011 at 08:39 PM.
    Entia non sunt multiplicanda sine necessitate

  11. #11
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    Sweet!

    Thank you so much. I'll get to work with this code immeadiatly.

  12. #12
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Visit Site Address Macro

    Drus,

    This is what I came up with. Hope it helps.
    You must make sure you have "Microsoft HTML Object Lib" selected in the "Tools, Ref"
    for this code to work.

    Please Login or Register  to view this content.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  13. #13
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    Thank you Charles!

    A quick question: Where do I save this code? Inside "module1" or "workbook" or "sheet1" etc? Which is it? And if I have other macros save in my workbook how do I keep em' separate?

    Sincerely,
    Andrew
    Last edited by Drus; 01-30-2011 at 03:06 PM. Reason: Grammar

  14. #14
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Visit Site Address Macro

    Hi,

    In Module1

  15. #15
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    Hey uhmm

    My excel worksheet is 2007 in spanish, therefore starting from left counting to the right, which number is the "Tools" tab?

  16. #16
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Visit Site Address Macro

    If you want I can post the workbook.
    Do not know if info is private let me know and I'll post it.

  17. #17
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    I found what you meant by Tools -> Reference -> Microsoft Html Lib..


    Code seems ok, but it is not working. I have in module1 some other code. Maybe that's what is making all the trouble.


    EDIT:

    I uploaded the new workbook so you can see it. Columns are all the same.
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Visit Site Address Macro

    Hi,

    The attached is what I came up with. It, however does not contain the Function code supplied on this forum. I modified my original code.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    I get an error display #1004.

    Error in the method of paste special of the class range. (I translated this from spanish to english.)

  20. #20
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Visit Site Address Macro

    Hi,

    Where does the debug show for the error?
    Which workbook did you test the code with? The one I supplied or the one you posted on the forum?

    Sorry you did say rror was for the Paste.
    Still which workbook did you use
    Last edited by Charles; 01-30-2011 at 04:33 PM. Reason: update remark

  21. #21
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Visit Site Address Macro

    For a working example look here.



  22. #22
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Talking Re: Visit Site Address Macro

    Dear Charles, and everyone else viewing this thread,

    I have finally integrated the code that you sent me with that worksheet. It is working perfectly!!! This thread is solved.

    However I am missing to add the button you had in the previous worksheet you sent me.


    This is my final post. I have attached the final worksheet (it just missing the "Url" button.


    Many thanks.
    Attached Files Attached Files
    Last edited by Drus; 01-30-2011 at 04:56 PM. Reason: added attachment

  23. #23
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Visit Site Address Macro

    Thanks for letting us know that your project is done, you can add the button and attach it to the code.

  24. #24
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    Sorry I don't know how to create a button in excel.

    I would appreciate you explained it to me, rather than sending me the worksheet with it. So I can learn for future projects.

  25. #25
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Visit Site Address Macro

    Hi,

    If you are using 2007 click the "Developer Tab"
    Click "Design Mode"
    Click "Insert"
    You will see a drop down
    You will also see in the header for the dropdown "Form Control"
    Click on the "Button" which is the top left button in the Form Control
    Now on you worksheet you can click any place that you want and a button will appear and when it does it will show a display box for you to assign the button too. Select the Macro and then click Ok. You should now be able to run the macro from that button.
    Also deselect The Design Mode, you really do not need to select it.

  26. #26
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    I see. I will try to do as you say.

    I found 2 things:

    The macro actually works,

    I believe I may have missplaced in the macro code the location of the output cell which it is only copying "http://services.runescape.com/m=avatar-rs//chat.gif " from a cell, therefore the url returned is not the correct one.

    Maybe you could look at it.

    Also I have an observation, the loop of the macro will make it run until it finds a cell with no "display name" content?
    Attached Files Attached Files

  27. #27
    Registered User
    Join Date
    01-28-2011
    Location
    SPS, Honduras
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Visit Site Address Macro

    All issues have been solved. Thanks to Charles and everyone else who helped me.

    One final attachment 100% functional at your disposal. Thread will be marked as solved.
    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)

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