A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , , , , ,

Link to Excel File on Outlook Form, like hyperlink click and it opens





 
 
Thread Tools Display Modes
  #1  
Old June 5th 07, 02:07 PM posted to microsoft.public.outlook.program_vba
freeman642@gmail.com
external usenet poster
 
Posts: 12
Default Link to Excel File on Outlook Form, like hyperlink click and it opens

I need to have a link on an Outlook VBA form that links and opens an
excel file, does anyone know of a way to do this? Have seen links to
internet explorer but not opening a file on a shared network drive.
Thanks John

Ads
  #2  
Old June 5th 07, 03:10 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Link to Excel File on Outlook Form, like hyperlink click and it opens

See my response to your post in another group.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/article.aspx?id=54

wrote in message ups.com...
I need to have a link on an Outlook VBA form that links and opens an
excel file, does anyone know of a way to do this? Have seen links to
internet explorer but not opening a file on a shared network drive.
Thanks John

  #3  
Old June 5th 07, 04:41 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 817
Default Link to Excel File on Outlook Form, like hyperlink click and it op

The code to open a file needs the following Win32 API declaration in the
General Declarations section of a new Module (you can't put it in the code
behind the UserForm):

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

Then you can launch the file like this:

Dim varRet As Variant
varRet = Shell("""C:\Program Files\Microsoft Office\Office12\EXCEL.EXE""
""C:\Temp\myworkbook.xls""", vbNormalFocus)

Change 12 in the file path to 11 if you are using Office 2003.

The trickiest part is making the user think he's clicking on a hyperlink.
None of the built-in controls are satisfactory for replicating a true "URL
clicking experience". For example, you'd have to manually make the text blue
and underlined and write additional code to change the cursor to a
hand-with-finger during a MouseOver event for the control.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

I need to have a link on an Outlook VBA form that links and opens an
excel file, does anyone know of a way to do this? Have seen links to
internet explorer but not opening a file on a shared network drive.
Thanks John


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Everytime i click a link in O/E email, it opens a 'new' browser window? JethroUK© Outlook Express 17 April 11th 07 10:34 AM
Clicking hyperlink in Outlook opens dozens of blank IE pages. Siddartha Outlook - General Queries 1 January 11th 07 04:14 PM
Can I link an excel hyperlink to a public contacts folder or conta Jordan Mullet Outlook - Using Contacts 1 June 8th 06 07:21 PM
Click link opens AOL instead of Firefox kathrynatgwens Outlook - General Queries 1 January 31st 06 06:53 PM
2nd request - Click link opens AOL instead of Firefox KathrynBassett Outlook - General Queries 3 January 30th 06 06:44 PM


All times are GMT +1. The time now is 05:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Credit Cards - Refinance - Kung fu for a healthy you - Free Credit Report - Loans