lameid,
Your strPic = "<CDROM>" & txtLink.text was in the right direction but first I had to get the system to figure out where the CD rom drive was. I found this code at the Microsoft site (changed it slightly).
This went in the form.
Private Sub Main()
' Call the GetFirstCdRomDriveLetter() and store the
' return value in strDriveLetter.
If strDriveLetter <> "" Then Exit Sub
strDriveLetter = GetFirstCdRomDriveLetter()
End Sub
In the sub on the form that uses the drive letter I have:
strPic = txtLink
strPic = strDriveLetter & strPic
In the module.
Declare Function GetDriveType Lib "kernel32" Alias _
"GetDriveTypeA" (ByVal nDrive As String) As Long
Declare Function GetLogicalDriveStrings Lib "kernel32" Alias _
"GetLogicalDriveStringsA" (ByVal nBufferLength As Long, _
ByVal lpBuffer As String) As Long
Public Const DRIVE_CDROM As Long = 5
' FUNCTION:
' GetFirstCdRomDriveLetter()
'
' PURPOSE:
' Finds the first CD-ROM device and then returns its drive letter.
'
' ARGUMENTS:
' None
'
' RETURNS:
' A string that represents the first CD-ROM drive letter. If the
' function fails for any reason, it returns vbNullString.
'
' **********************************************************************
Function GetFirstCdRomDriveLetter() As String
' Declare variables.
Dim lDriveType As Long
Dim strDrive As String
Dim lStart As Long: lStart = 1
' Create a string to hold the logical drives.
Dim strDrives As String
strDrives = Space(150)
' Get the logial drives on the system.
' If the function fails it returns zero.
Dim lRetVal As Long
lRetVal = GetLogicalDriveStrings(150, strDrives)
' Check to see if GetLogicalDriveStrings() worked.
If lRetVal = 0 Then
' Get GetLogicalDriveStrings() failed.
GetFirstCdRomDriveLetter = vbNullString
Exit Function
End If
' Get the string that represents the first drive.
strDrive = Mid(strDrives, lStart, 3)
Do
' Test the first drive.
lDriveType = GetDriveType(strDrive)
' Check if the drive type is a CD-ROM.
If lDriveType = DRIVE_CDROM Then
' Found the first CD-ROM drive on the system.
GetFirstCdRomDriveLetter = strDrive
Exit Function
End If
' Increment lStart to next drive in the string.
lStart = lStart + 4
' Get the string that represents the first drive.
strDrive = Mid(strDrives, lStart, 3)
Loop While (Mid(strDrives, lStart, 1) <> vbNullChar)
End Function
This works like a charm but I'm still interested if anyone know how to use the 'alias' system name and how to handle it if they have more than one CD rom drive. Right now I'm using an error handler.
Thanks.
L