Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Making code global in workbook

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Making code global in workbook

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Making code global in workbook

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a function global GM Excel Programming 4 February 2nd 06 09:38 PM
Help with VBA code, making it spacific to one workbook polska2180 Excel Programming 0 September 27th 05 07:47 PM
Making pictures global nollaig Excel Programming 2 June 2nd 05 10:51 PM
Referencing global values in one workbook from another Datasort Excel Programming 0 January 11th 05 08:13 PM
Through code : Making a global change to 100 templates Ajit Excel Programming 1 August 25th 04 01:52 PM


All times are GMT +1. The time now is 01:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"