+ Reply to Thread
Results 1 to 11 of 11

How to Auto-Hyperlink cells to folders with same name?

  1. #1
    Forum Contributor
    Join Date
    01-08-2013
    Location
    ankara
    MS-Off Ver
    Excel 2010
    Posts
    123

    Lightbulb How to Auto-Hyperlink cells to folders with same name?

    Untitled 1.jpg

    In my # Liste named excel file, I have a list of people (as you see on B column) and a folder for each of them with their names.

    I want this if you can help me:
    When I select a cell and press macro button, I want macro to create a hyperlink to the folder in same location as in picture.

    Extra:
    1. In addition to macro above, is it also possible to create a folder with same name? That would save my time from creating folder with same name.
    2. After a while I compress folders in rar format with same name and move to archieve folder. Is it possible something like: "if hyperlink doesn't work, go to archieve folder and hyperlink to a rar file there?"


    I am an amateur macro user and wonder about the limitations of VBA by my last two additional questions. Thanks in advance..

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to Auto-Hyperlink cells to folders with same name?

    You can use the code attached to create the folder and the hyperlink
    Please Login or Register  to view this content.
    To deal with folders being archived/compressed and hyperlinks becoming invalid as a result, I suggest you write a small routine that checks the validity of all hyperlinks on the workhseet and if the target folder cannot be found, change the hyperlink address to the archive folder.
    If you like my contribution click the star icon!

  3. #3
    Forum Contributor
    Join Date
    01-08-2013
    Location
    ankara
    MS-Off Ver
    Excel 2010
    Posts
    123

    Re: How to Auto-Hyperlink cells to folders with same name?

    error.jpg

    Thank you for your close interest but I got this error above. The color of "Folder" is black unlike Object and String. I guess somehow I need to define "Folder" first.

    I can understand what you wrote but can't activate Folder.

  4. #4
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to Auto-Hyperlink cells to folders with same name?

    Sorry my mistake. I changed the code to late binding but forgot the folder. Please change to type Object (just like fso).

  5. #5
    Forum Contributor
    Join Date
    01-08-2013
    Location
    ankara
    MS-Off Ver
    Excel 2010
    Posts
    123

    Re: How to Auto-Hyperlink cells to folders with same name?

    That works great OllieB. VBA amazed me after this job, ty

    Also meanwhile I was looking for how to define Folder and this answer from a website solved previous problem as well. I wrote here in case some other people want to use other way:

    You need to reference th project to
    Microsoft Scripting Runtime
    Tools -> References in the VBE
    Just hyperlink doesn't work on folders with # but I can rename path of course. (D:\Hazine\# Başvurular\Bitmeyenler)

  6. #6
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to Auto-Hyperlink cells to folders with same name?

    You basically have two possibilities. One is called early binding in which case you will have to set a reference to the Microsoft scripting runtime. When you use this method object types like the folder in our example are known to the compiler. The second method is called late binding. No reference is needed and variables are declared as objects. Both are valid approaches, each with their own advantages and disadvantages.

  7. #7
    Forum Contributor
    Join Date
    01-08-2013
    Location
    ankara
    MS-Off Ver
    Excel 2010
    Posts
    123

    Re: How to Auto-Hyperlink cells to folders with same name?

    I see what you mean.

    Do you have any suggestion about how to start VBA programming or a website which gives small codes as I requested here? I have qbasic, matlab and little JAVA background.

  8. #8
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to Auto-Hyperlink cells to folders with same name?

    I myself have learned by trying and using Google. I believe the first thread in this forum contains lots of information, links and books for people learning VBA

  9. #9
    Forum Contributor
    Join Date
    01-08-2013
    Location
    ankara
    MS-Off Ver
    Excel 2010
    Posts
    123

    Re: How to Auto-Hyperlink cells to folders with same name?

    thanks a lot

  10. #10
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to Auto-Hyperlink cells to folders with same name?

    Ps with your background it is going to be a piece of cake

  11. #11
    Forum Contributor
    Join Date
    01-08-2013
    Location
    ankara
    MS-Off Ver
    Excel 2010
    Posts
    123

    Re: How to Auto-Hyperlink cells to folders with same name?

    I will ask another tough question in another topic

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

X vBulletin 4.1.8 Debug Information

  • Page Generation 0.07136 seconds
  • Memory Usage 9,099KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (11)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (4)navbar_noticebit
  • (6)option
  • (11)postbit_legacy
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (4)showthread_bookmarksite
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper
  • (1)vbseo_linkbackmenu_entry 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (39):
  • ./vbseo.php
  • ./env.php
  • ./vbseo/includes/functions_vbseo.php
  • ./vbseo/includes/functions_vbseo_pre.php
  • ./vbseo/includes/functions_vbseo_url.php
  • ./vbseo/includes/functions_vbseo_createurl.php
  • ./vbseo/includes/functions_vbseo_db.php
  • ./vbseo/includes/functions_vbseo_vb.php
  • ./vbseo/includes/functions_vbseo_seo.php
  • ./vbseo/includes/functions_vbseo_misc.php
  • ./vbseo/includes/functions_vbseo_crr.php
  • ./vbseo/includes/functions_vbseo_cache.php
  • ./vbseo/includes/functions_vbseo_hook.php
  • ./vbseo/includes/functions_vbseo_startup.php
  • ./includes/config.php
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/functions.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/functions_cforum.php
  • ./includes/functions_facebook.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php
  • ./includes/functions_notice.php 

Hooks Called (46):
  • init_startup
  • friendlyurl_resolve_class
  • database_pre_fetch_array
  • database_post_fetch_array
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • cache_templates
  • template_register_var
  • parse_templates
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • reputation_image
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete


Search Engine Friendly URLs by vBSEO 3.6.0 RC 1