Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-21-2011, 11:07 PM
Catalin.B Catalin.B is offline HyperLink help please Windows Vista HyperLink help please Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default


Maybe i didn't understand what you need.
Try this: (in cells you must enter just the file name with extension, simply click on a cell , then start macro. It will open the file with the path specified in macro, and the name found in the active cell)
Code:
Option Explicit
Private 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
Sub openfiles()
Dim FileName, FilePath As String

    FileName = ActiveCell
FilePath = "E:\catalin\muzica" 'ThisWorkbook.Path  '"N:\video\movies\"
If Len(Dir(FilePath & "\" & FileName)) = 0 Then
MsgBox ("File " & FilePath & "\" & FileName & " not found!")
Exit Sub
    End If
    ActiveWorkbook.FollowHyperlink FilePath & FileName, NewWindow:=True
End Sub
Sub PlayVideo()
  Dim FileName As String
  Dim FilePath As String, retVal
  
    FileName = ActiveCell
    FilePath = "E:\catalin\muzica"
    
    retVal = ShellExecute(0&, "open", FileName, vbNullString, FilePath, 1&)
    
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
HyperLink help please Hyperlink Mahmuz Word 2 05-04-2011 10:59 AM
Followed hyperlink question dth122 PowerPoint 0 06-06-2010 07:15 PM
Hyperlink Warning gfkbob Outlook 0 01-23-2010 06:50 AM
Hyperlink ltvjim Outlook 0 03-28-2007 10:28 AM
hyperlink scuba32 Word 0 08-24-2006 07:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft