January 26, 2013

search subfolders and Add hyperlink for file from the top level folder in Excel

To search subfolders and Add hyperlink for file from the top level folder using Macro code in Excel. You can take help from code below.

Private Files As Dictionary
Private StrFile As String
Public Function FindFolder(strpath As String) As String
Dim fs, f1, f2, FleCollection
Set fs = CreateObject("scripting.filesystemobject&quot ;)
Set f1 = fs.getfolder(strpath)
Set f2 = f1.subfolders
Set FleCollection = f1.Files
For Each subfld In f2
FindFolder subfld.Path
Next
For Each fle In FleCollection
Files.Add fle.Name, fle.Path
Next
End Function


'add below code before adding hyperlink

If (Files Is Nothing) Then
Set Files = New Dictionary
End If
'Filename should contain Extension like "test.pdf"
If Not ((Files.Exists(Filename))) Then
'replace c:\ with root folder of the file,if you are no sure about  Root folder, You need to call it with all possible drives like "C:\" "D:\" etc
FindFolder "c:\"
Else
Filename = Files.Item(Filename)
End If
 

No comments:

Post a Comment

Categories

.NET (3) .net tips and trick (8) A Query That Deletes from the Right in Sql select (1) Aankhen Khuli Ho (1) Acting classes (1) acting institute (1) Active directory infrastructure (1) Add items to menu at runtime using asp.net (2) Adding items from listbox to database in visual basic (1) administrator users (1) adodb record set (1) advantages of asp with csharp over asp with vb.net (1) advantages of ERP system (1) Airlines of India (1) AJAX (3) album review (3) Alexa (1) All songs notation (7) Antivirus (4) AP Purchase order posting by code in dynamics axapta (1) Architecture Interview Question Java Interview Question (1) Articles (5) Asp.net programming (27) Axapta training centers (1) BLOB (1) Blocking websites (1) Blogging (10) Books to improve english grammer and vocabulary (1) boot prompts (1) Bulk insert records into table in sql or oracle (1) C programming and tips (5) C sharp donet code to Get Single query Data (1) C# Interview Questions (2) C#.net Programming (13) c++ (35) charlie chaplin comedy (3) check existence of value in procedural language (1) classes and interfaces (1) Code to send email using PLSQL (1) code to show calendar using php program (1) Code to The Workbook Opens Each Sheet is in the Home Position But the Cursor is On particular Cel (1) Collection of God photo (4) combo box in excel (1) command to know the incoming network connections in unix (1) Command to reindiex database tables in sql (1) Common Errors of windows (4) Computer Fundamental (2) Convert To Letter in excel micro (1) Convert xml file to excel using vb.net code (1) Copy a column of data from one table to another in sql (1) copy a range/column after the last column with data (1) copy paste data by code (1) Courses colleges and Institutes (7) Create a New Drive for your Favourite Folder in Artificial Intelligence (1) create an Index sheet for all the worksheets within the workbook (1) create table code (2) create table dynamically (1) Crystal Report (3) crystal reports codes (2) CSharp Interview Questions (2) CSharp Interview Questions and answer (2) Data Recovery Softwares (1) DataSet (1) DBMS (2) declare and define trigger (2) decrypt data using .net (1) definition of delegate (1) delete array element (1) delete from table (1) derived class pointer (1) desktop (2) Development Management (2) Development Studies (2) DFD (1) Difference between primary key and unique key (1) Difference between shared and private assembly in dot net (1) Difference between subquery and corelated subquery (1) Difference between Visual C++ and Visual C++.NET (1) Difference Normal INDEX And BITMAP INDEX (1) differences between .NET application and a Java application (1) different application domain (1) Digital signatures (1) Display all palindromes in one single string entered by user using c++ (1) Display an image on calendar control in a particular date in asp.net using C# (1) division and multiplicaiton (1) domain name registrations (1) Domains (7) DOTNET (1) Dynamics Axapta (2) ebook pdf (1) Elctronics and telecommunication e-book (1) Embedded system (1) English learning (3) ERP Companies (1) ERP Coverage (1) example of goto statement (2) example of gpupdate (1) Example of group by (1) Example of INSERT trigger to fire upon the insert of a new record (1) example of interface using .net (1) Example of join select query in sql (1) Example of left join in sql (1) example of MTA (1) Example of New operator overloading example in c++ (1) Example of PL/Sql (1) Example of regexp_replace function in select query (1) Example of self join query in sql (1) Example of SQL script injection (1) Example of trigger using procedure language (1) example of vlookup in excel (1) examples of date format in sql (1) exce data combine trick (1) excel code to import (1) Excel Tips and tricks (12) fibonocci (1) fiilm songs in hindi (1) Film Studio at Mumbai (1) find out maximum value from group by query (1) fork (1) get element by tagname (1) get Grand Total using query (1) get passport (1) global warming (1) God (2) Google tips and tricks (1) GRE (5) Hai mera dil to awara (5) Hardware tips and tricks (11) Image Handling in .Net (1) Internet (2) Internet learning tutorials (4) Interview questions and answer (15) Investment of Money (2) ITIL Foundation v.3 Certification (1) Java and Servlets (5) Jobs and Career (3) Latest Jobs (3) Linux (13) Macros in MS Excel (17) Mathematics tips and trick (3) MB5-858 (1) MCTS 70-562 (1) Microsoft 70-506 (1) Microsoft 70-512 (1) Microsoft 70-576 (1) Microsoft 70-647 (1) Microsoft Certifications (1) Microsoft Silverlight (1) Microsoft Windows (1) Mobile technology (2) Music songs and notations (11) MySQL (1) Navision (2) Networking and communication (12) NGOs (4) Peoples and places (8) Philosophical (2) PHP (4) Physics Topics (6) PL/SQL Programming (5) placing MySQL database from local computer to host (1) Puzzles (3) Re-indexing (2) recipes (1) Rent sales and buy properties (7) Retail Management (1) SDLC (2) SMS (3) Software Engineering (3) Software testing tips and trick (1) Sql query (17) SQL Tips and trick (29) SQL Trigger (5) Stored Procedure (12) Syntax (1) System and Network Administration (1) Topics and Theory (1) Transistors (1) UNIX (3) VB.net programming (2) videos (6) Virus Diseases and Solution (1) VS.Net Theory (1) web services (2) Weblinks (14) Windows tips and trick (7) world of Acting and Entertainment (4)

Followers

Recent Visitors

Google+ Followers