View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson[_2_] Chip Pearson[_2_] is offline
external usenet poster
 
Posts: 95
Default Excel Global Variable Setting

John,

The Public declaration must appear outside of and before any Sub or Function
procedure in the module. So your code would look something like

Option Explicit
Public WBpath As String
Public timesheet As String

Sub Auto_Open()
WBpath = ActiveWorkbook.Path
timesheet = ActiveWorkbook.Name
CD WbPath
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"John Baker" wrote in message
...
Chip I set it up thus:

Sub auto_open()
'
' auto_open Macro
' Macro recorded 11/25/2003 by John H Baker
'
WBpath = ActiveWorkbook.Path

timesheet = ActiveWorkbook.Name
'
Public WBpath As String
Public timesheet As String
cd WBpath

End Sub

It does not like the Public statement. I have no idea what I have done

wrong.
Can you point me in he right direction?

Regards

John Baker

"Chip Pearson" wrote:

John,

Declare the variable, as below, before and outside of any procedure.

Public Send As String