+ Reply to Thread
Results 1 to 6 of 6

VBA code to make web-address as variable dependent.

  1. #1
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    VBA code to make web-address as variable dependent.

    Dear all,
    I have a macro to extact a file from a web address. The format is as shown below,

    "http://www.xxxxxx.com/xxxxx/xxxxx/xxxx/YYYYMMDD/filename.xlsx"

    Here, YYYYMMDD is the date (in specified format), which keeps on updating for everyday and is time dependent.
    For example,
    If am trying to get this link before 3PM of the day, this date will previous day date.If its more than 3PM, then it will be todays date. In simple words, this date will be previous day or present day date depending upon time (3PM)
    I want to automate this link based on this Date and time critaria.

    Secondly,
    I want to take this 'filename.xlsx' name from a cell value,means, i will ask user to enter file names into excel cells (as there are many files) and keyin this file name into this web address from the excel cell. As of now consider 2 cells with 2 different file names.

    I hope i am clear.

    Please provide me the VBA code to achieve both of the above.

    Thanks for all your great help..

    Regards,
    Madvesh.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,896

    Re: VBA code to make web-address as variable dependent.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: VBA code to make web-address as variable dependent.

    Hello mchilapur,

    Here is UDF that will take the file name from a cell a return the URL based on the time.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code to make web-address as variable dependent.

    Hey Thanks for your fast response..
    I dont why, above both VBA codes didnt link to web address.

    Later i removed BaseURLvariable and modified code as below
    Workbooks.Open Filename:= "http://www.xxxxxx.com/xxxxx/xxxxx/xxxx/" & DateStamp & "/" & Range("A1")

    This work good...
    Thanks again..Have a gr8 day...

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,896

    Re: VBA code to make web-address as variable dependent.

    Quote Originally Posted by mchilapur View Post
    I dont why, above both VBA codes didnt link to web address.
    You didn't say you wanted to link to it, just that you wanted the URL. You said you already had the code to extract the file. My code provides a URL string that can be used any way you want in the code, and Leith Ross used equivalent logic to build a UDF that can be used in a worksheet or from VBA to provide a URL to the file.

    Getting the right answer depends on asking the right question I'm glad you worked out the last bit and got what you needed.

  6. #6
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code to make web-address as variable dependent.

    Hmmm..Thats true..Sorry and thanks.

+ 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. Replies: 4
    Last Post: 05-07-2014, 03:08 AM
  2. [SOLVED] Assigning A Cell Address to A Variable, Using A Variable - Error '1003'
    By ch_abs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-28-2014, 01:36 PM
  3. [SOLVED] Would using Classes make this work? (Constant values dependent on variable value)
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-14-2013, 07:35 PM
  4. I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2013, 02:41 PM
  5. [SOLVED] I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2013, 12:54 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