+ Reply to Thread
Results 1 to 9 of 9

Copy link to a browser and export a file

  1. #1
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Copy link to a browser and export a file

    Hi,

    I have a link address in a cell: http://finance.yahoo.com/d/quotes.cs...OG+YHOO&f=snd1
    I would like to use VBA/Macros to help do the following automatically:

    -Copy and paste this link to an internet browser, eg. Firefox and let browser direct to this address
    -After pasting and clicking Enter, the browser will display a dialog box to ask if we need to open a file with Excel
    -Click Yes to open with Excel
    -Always save into existing workbook

    I do not know VBA at all. Please help.

    Thanks a lot.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Re: Copy link to a browser and export a file


    Hi,

    no need browser ‼ You can directly open the URL file in Excel just by using Workbooks.Open method for example,
    just see in VBA inner help, beginner level …

    Or just activate Macro recorder, open the URL file, copy / paste data : you will have a free code !

  3. #3
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Copy link to a browser and export a file

    Hi Marc,

    Only the browser can generate the Excel file I need. I have tried to insert hyperlink with the URL address but it has produced some codes I don't understand.

    Regards,

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Copy link to a browser and export a file


    Working on my side without browser !

    But you can also do a search and learn how to pilot a browser …

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Copy link to a browser and export a file

    Quite simply:

    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

  6. #6
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Copy link to a browser and export a file

    Very understandable advice.
    But it appears with run-time error "1004" when running and requires debug on "With Workbooks.Open(ActiveCell.Value2)"
    How to solve it please?

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Copy link to a browser and export a file

    You need to select the cell with the lin in first

  8. #8
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Copy link to a browser and export a file

    I finally got it. Thanks a lot.
    One more question: How do I change the codes to save into a designated file?

  9. #9
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Copy link to a browser and export a file

    Hi, tywlam
    Quote Originally Posted by tywlam View Post
    ........How do I change the codes to save into a designated file?
    .. This is a good example of how you can easily get what you want From a Macro Recording.
    . I have no idea what exactly this Thread is about, but I simply ran Kyle’s code in debug mode ( In Development Window selected code and steped through with F8 and then stopped running the macro( Hit stop small square stop button above in the development Window Ribbon ( symbol Bar ) ) after the first line before it did the
    .Save

    . I then ran a macro recording while I did a save As manually where I saved in the place I wanted the File to be saved. Then I stopped the macro recorder (Small square button bottom left of the worksheet in the Bottom Spreadsheet Ribbon ( Status Bar ) , or view >> Macros >> Stop Recording )
    . I got this code:

    Please Login or Register  to view this content.
    …..

    So I modified Kyle’s code so..

    Please Login or Register  to view this content.

    . Then ( after deleting the file created – I found a Folder called tywlamStuff-Dateien and an Chrome HTML Document called tywlamStuff in my Folder on a OSB Stick with this Path F:\ExcelForum\Hyperlinks\ ) I ran the program. I did it in debug Mode again so as to see wjere, ( if ) anything went wrong. Nothing did go wrong, and i got the Two thing again in the desired Folder.
    . This particular example is also a good example of when a macro recording is very useful, even to experienced users. The particular Arguments which are often not optional when saving files are so many that no one bothers to remember them all.

    Alan

    P.s. 1 ) If this Thread is solved for you, then please mark it as solved
    P.s.2 ) When you follow on a request, as you have done here
    http://www.excelforum.com/excel-prog...ro-button.html
    .. then please reference this link
    http://www.excelforum.com/excel-prog...rt-a-file.html
    .. as that may help someone getting started with helping you.
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

+ 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. Open link from spreadsheet into user's default browser
    By Steve_123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2015, 10:42 AM
  2. Export/Copy a Text File to a Web Server
    By TedN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-30-2012, 09:33 PM
  3. [SOLVED] Copy & Paste Values, then export to CSV file
    By j9070749 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-13-2012, 12:52 PM
  4. Excel prints everytime I click a link in embedded microsoft web browser activex
    By philipbc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2010, 07:51 AM
  5. Macro - Copy cell area and export to bitmap or any other graphic file?
    By Dno in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2007, 07:02 PM
  6. File Browser
    By Baapi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-12-2006, 04:57 PM
  7. Replies: 4
    Last Post: 05-18-2006, 11:25 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