Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an Excel form that when a user clicks a button, I want to open up a particular .PDF file on the screen
Can anyone show me the code necessary to do this? TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
did you ever get any responses to this? i am trying to do the very same, seemingly very simple, procedure, and am getting nowhere!
thanks heid ----- Joey wrote: ---- I have an Excel form that when a user clicks a button, I want to open up a particular .PDF file on the screen Can anyone show me the code necessary to do this? TIA |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joey,
You can use the ShellExecute API function for this. Basically, when used with the "open" verb, ShellExecute will open the specified file with its default application. Here's the code needed to do it: Private Const SW_SHOWMAXIMIZED = 3 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 Public Function gbOpenFile(rsPath As String) As Boolean If ShellExecute(0, "open", rsPath & vbNullChar, _ vbNullString, vbNullString, SW_SHOWMAXIMIZED) 32 Then gbOpenFile = True End If End Function There are other SW_* constants that determine how the window is displayed. There are lots of return value constants that can help you trap runtime errors (instead of just checking for 32), too - just look for shellexecute on MSDN for more info on them. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Joey wrote: I have an Excel form that when a user clicks a button, I want to open up a particular .PDF file on the screen. Can anyone show me the code necessary to do this?? TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
resize my worksheet-there is no maximize button showing | Excel Discussion (Misc queries) | |||
How to fix my spreadsheet from showing formula to showing answer | Excel Discussion (Misc queries) | |||
How to fix my spreadsheet from showing formula to showing answer | Excel Discussion (Misc queries) | |||
Date showing incorrect. 30:00 hrs showing 06:00 | Excel Discussion (Misc queries) | |||
Showing/ not showing "getting started" when excel starts | Excel Discussion (Misc queries) |