Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have found this code below to be great for opening PD files, however I do
not know how to make it global through out my workbook. That is with out pasting the code in each and every module I create (including worksheet modules). Any help is appreciated. '====== 'Author: Jean-Guy Marcil 'Place this before the first procedure, at the top of the module 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 'This is the function that does the work Public Sub OpenAcrobatFile(strFile As String) ShellExecute 0, "open", strFile, vbNullString, vbNullString, 9 End Sub 'In a regular sub, use this to call the function to open the PDF file without any warnings: OpenAcrobatFile "C:\MyPath\FileName.pdf" '====== -- Regards VBA.Noob.Confused XP Pro Office 2007 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 17, 4:17*pm, Rick S. wrote:
I have found this code below to be great for opening PD files, however I do not know how to make it global through out my workbook. That is with out pasting the code in each and every module I create (including worksheet modules). Any help is appreciated. '====== 'Author: Jean-Guy Marcil 'Place this before the first procedure, at the top of the module 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 'This is the function that does the work Public Sub OpenAcrobatFile(strFile As String) * ShellExecute 0, "open", strFile, vbNullString, vbNullString, 9 End Sub 'In a regular sub, use this to call the function to open the PDF file without any warnings: OpenAcrobatFile "C:\MyPath\FileName.pdf" '====== -- Regards VBA.Noob.Confused XP Pro Office 2007 instead of using public sub try using Public Function |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your reply, but I think that for right now, this is over my head.
Like a stealth helicoptor, circling, repeatedly, and I don't know its there. LOL -- Regards VBA.Noob.Confused XP Pro Office 2007 "GTVT06" wrote: On Jan 17, 4:17 pm, Rick S. wrote: I have found this code below to be great for opening PD files, however I do not know how to make it global through out my workbook. That is with out pasting the code in each and every module I create (including worksheet modules). Any help is appreciated. '====== 'Author: Jean-Guy Marcil 'Place this before the first procedure, at the top of the module 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 'This is the function that does the work Public Sub OpenAcrobatFile(strFile As String) ShellExecute 0, "open", strFile, vbNullString, vbNullString, 9 End Sub 'In a regular sub, use this to call the function to open the PDF file without any warnings: OpenAcrobatFile "C:\MyPath\FileName.pdf" '====== -- Regards VBA.Noob.Confused XP Pro Office 2007 instead of using public sub try using Public Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Making a function global | Excel Programming | |||
Help with VBA code, making it spacific to one workbook | Excel Programming | |||
Making pictures global | Excel Programming | |||
Referencing global values in one workbook from another | Excel Programming | |||
Through code : Making a global change to 100 templates | Excel Programming |