Excel hyperlinks - using only part of the URI

schatham

New Member
Joined
May 28, 2003
Messages
42
I've got an opportunity where I need to take a logfile (output from a powershell script), where I am logging a filename (full), target & working directory folders, etc. The Powershell script recursively searches a file folder for shortcut files (.lnk), and then changes info on the Target (to a new drive where the folder structure is preserved) - which may be a shortcut (.lnk) file, an executable, a batch file and so on. It also changes the working directory which may or may not be in the same folder as the Target.

The output is all on one line, which I am planning to import into Excel, and from that create a hyperlink where the user who has to make a change from an error log can click on the hyperlink & be taken to that file folder.

An example is below (I've broken it out on different lines for readability)
CurrShortcut = C:\Main Library\Subfolder1\Subfolder1A\Subfolder1AA\shortcut1.lnk
CurrPath = Z:\MyApp\Subfolder1\Subfolder1Q\Subfolder1QZ\app.exe
ProposedPath = C:\MyApp\Subfolder1\Subfolder1Q\Subfolder1QZ\app.exe
... and so on for the Working folder path.

What I know about the folders -
1. Both the Shortcuts and the Proposed & Current paths can be variable in length and depth, meaning that Subfolder1 may have 2 levels below it, while Subfolder2 may have 6 levels below it (either on the shortcut or the path)
2. One does not obviously relate to the other, meaning that something at 3 folders deep in the shortcuts may not be 3 folders deep in the Paths.
3. The Paths can be either drive letters or server names (\\myserver\MyApp.....)

What I need to do in Excel is to import that text file, and then parse out the info in it to supply the user with a hyperlink. However, I do NOT want to provide them with the hyperlink to the executable. The main one I want to do this for is the shortcut, as that will have to be where the user starts their review process.

Is there a way to do this in excel (relatively easily)?

I know it can be done in Powershell, but I've already got that running & didn't want to make lots of changes in it if it could be avoided.

Any help, thoughts or suggestions appreciated.

Many thanks!!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,216,075
Messages
6,128,657
Members
449,462
Latest member
Chislobog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top