Results 1 to 6 of 6

Thread: Hyperlinks, kind of....

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Seattle
    Posts
    954
    Is it possible to send a user an address to a file using either a UNC name or drive path and have that user be able to click on that path like a hyperlink and bring the file up? Example:

    \\servernmame\volume\file.filexetension

  2. #2
    Hyperactive Member vbuser1976's Avatar
    Join Date
    Sep 2000
    Location
    Yonkers, NY
    Posts
    404

    Question Hmm, Not sure...

    I'm not sure, but I think you can. Is this for a web app? If it is, can't you use vbScript to specify that it is a hyperlink? I know how to do it in HTML, not in VB, though:

    Code:
    <a href="path/name/here">Path name here</a>
    I hope this helps, though. Good Luck.
    -vbuser1976
    VB6 Enterprise SP6
    SQL 7.0 SP2
    VBScript, HTML, Javascript, C++, a little UNIX

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Seattle
    Posts
    954
    This app is not for the web I want to send a link to a file for the proper person but attach the file. I thought that if I could send a link that they just could click on and open the file it would be more convenient for them. Any other suggestions?

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Seattle
    Posts
    954
    I think that I got it, you can use the shell command to open it. Example:

    Shell ("explorer " & "\\csd044\user\hartlbb\test.pdf"), vbNormalFocus

    This will open explorer and then open acrobat and the file.

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'Using Shelldef is more appropriate as you don't have
    'to hardcode the path to the applications that will open
    'the file associated with your filepath/file
    Code:
    '
    'This goes in a bas module
    '
    Option Explicit
    
    '
     Public Declare Function ShellEx Lib "shell32.dll" Alias _
     "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
     ByVal lpFile As String, ByVal lpParameters As Any, _
     ByVal lpDirectory As Any, ByVal nShowCmd As Long) As Long
     '
     Public Sub ShellDef(strFileName)
     Dim x
       x = ShellEx(Form1.hwnd, "open", strFileName, "", "", 1)
     End Sub
    
    'Form Event Code
    'this goes in your form
    'if your path or name is wrong this does not  produce
    'an error
    
    Private Sub Command1_Click()
    
     Dim strYourFileVariable As String
      strYourFileVariable = "c:\my documents\myFile.txt"
      ShellDef strYourFileVariable
    '=====================================
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  6. #6
    Member FrogBoy666's Avatar
    Join Date
    Aug 2000
    Location
    Columbia, SC
    Posts
    34

    Post

    You could always try something like this (I like it a little better than the Shell command)...

    Place the following code in the declarations section of a module...
    Code:
    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
    	ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal _
    	lpDirectory As String, ByVal nShowCmd As Long) As Long
    Public Const SW_MAXIMIZE = 3
    Public Const SW_MINIMIZE = 6
    Public Const SW_RESTORE = 9
    ... and place the following code in a form...
    Code:
    Private Sub Command1_Click()
    	Dim retval As Long
    	
    	' This will automatically open the document in it's associated application:
    	retval = ShellExecute(Form1.hWnd, "open", "\\csd044\user\hartlbb\test.pdf", "", _
    		"\\csd044\user\hartlbb\", SW_RESTORE)
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width