Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is it possible to get url info from internet shortcut files?

11 views
Skip to first unread message

Jóhan E. M. J. Sivertsen

unread,
Jul 22, 1999, 3:00:00 AM7/22/99
to
I need a function that can get the url & name from internet shortcut files.
We use Access97 and NT4 (we do have single license for Office 2000 Premium,
so if the feature is a part of Office 2000, that would also be helpful).

Do you know if it is possible, and if so, how?

Any help appreciated.

Jóhan

' Dir only returns the filename or foldername
strFilename = Dir("c:\winnt\profiles\someuser\favorites")

' Filedatetime only returns the savedate
dtmStamp = Filedatetime("anyfile")


Radu Lascae

unread,
Jul 22, 1999, 3:00:00 AM7/22/99
to
Hi Johan,

Maybe it shouldn't be this way but, as I have recently found out, the
FileSearch object will return the target for LNK files. Look in the help for
FileSearch (Access 97, not 95) and use the information from the returned Item
instead of the Dir function. You'll need to set a reference to the "Microsoft
Office 8.0 Library" (or a simmilar name).

Hth,
Radu Lascae

Dev Ashish

unread,
Jul 22, 1999, 3:00:00 AM7/22/99
to
Hi Johan,

To add to Radu's post, doing this the API way would require us to use some
typelibs that provide VBA friendly Interfaces. It's much easier to just
open the URL file with VBA's OPEN and read the url manually. Look for this
section

[InternetShortcut]
URL=http://www.rinkworks.com/dialect/

Also, you can use GetPrivateProfileString and other INI file functions to
read this more easily. Ken Getz wrote just such code for Informant, you can
try to get that particular article/code at < http://www.officevba.com >.

-- Dev

Jóhan E. M. J. Sivertsen <johan.s...@trygging.fo> wrote in message
news:eLY2GcE1#GA.259@cppssbbsa05...
: I need a function that can get the url & name from internet shortcut

:
:
:

Jóhan E. M. J. Sivertsen

unread,
Jul 27, 1999, 3:00:00 AM7/27/99
to
Radu & Dev, thank you for your reply!

The code below runned from Excel works fine. But it still needs
improvements. One is to get the favorites path from the registry. I have no
experience with reading from the registry, I can't find out, how to put the
favorites path in the GetSetting function.

Syntax: GetSetting(appname, section, key[, default])

How do I put this string in the "GetSetting" function?
My
Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explore
r\Shell Folders", key:="Favorites"

Jóhan

-oOo-

Sub GetFavorites()
Dim ia As Integer, idir As Integer, i As Integer
Dim path As String, f As String
Dim url As String
Dim afolders() As String

ReDim afolders(0)
' get path from registry
path = "c:\winnt\profiles\js\foretrukne\"
afolders(0) = path
ia = 0
idir = 0
Do While idir <= ia
path = afolders(idir)
f = Dir(path, vbDirectory)
If f = "." Then f = Dir()
If f = ".." Then f = Dir()
Do While f <> ""
If GetAttr(path & f) = vbDirectory Then
ia = ia + 1
ReDim Preserve afolders(ia)
afolders(ia) = path & f & "\"
End If
f = Dir()
Loop
idir = idir + 1
Loop

' put code for sortarray afolders here

i = 1
For ia = 0 To UBound(afolders)
path = afolders(ia)
f = Dir(path & "*.url")
Do While f <> ""
Open path & f For Input As 1
Input #1, url
Input #1, url
Close 1
Cells(i, 1) = Right(url, Len(url) - 4)
Cells(i, 2) = Left(f, Len(f) - 4)
Cells(i, 3) = afolders(ia)
i = i + 1
f = Dir()
Loop
Next ia
End Sub


Dev Ashish

unread,
Jul 28, 1999, 3:00:00 AM7/28/99
to

Hi Jóhan,

Two ways, you need to either use the REgistry APIs (messy), or
GetSpecialFolderLocation API with CSIDL_FAVORITES (easy). Try this link and
make sure you read the entire thread to get all the corrections.


< http://x34.deja.com/getdoc.xp?AN=503685684 >

-- Dev

Jóhan E. M. J. Sivertsen <johan.s...@trygging.fo> wrote in message

news:OdCjZmD2#GA....@cppssbbsa02.microsoft.com...

0 new messages