
Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
So Johnathan...what is the syntax to call to these public variables.
> > Can you establish variables and have them accessible to all macros within
> > a
[quoted text clipped - 42 lines]
> Public Const CompletedFormsPath As String =
> "G:\GS-220\SLATE\CORRECTION_SHEETS\CompletedForms\"
Jonathan West - 02 Aug 2007 17:42 GMT
> So Johnathan...what is the syntax to call to these public variables.
Exactly the same as to call variables or constants declared within a
rotuine.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Johnathan,
I get an 'Invalid Argument' when I use the constant:
Public Sub DefinePaths()
Public Const DataSourceFile As String =
"G:\GS-220\SLATE\CORRECTION_SHEETS\SCHOOL_LIST.xls"
Public Const DocumentTemplateFile As String =
"G:\GS-220\SLATE\CORRECTION_SHEETS\Correction Sheet.dot"
Public Const CompletedFormsPath As String =
"G:\GS-220\SLATE\CORRECTION_SHEETS\CompletedForms\"
End Sub
Sub AUTONEW()
Load UserForm1
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim NoOfRecords As Long
' Open the database
Set db = opendatabase(DataSourceFile, False, False, "Excel 8.0")
...
I'm wondering if I put this in the document properties as a custom property,
would that work? I was able to get the DataSourceFile and CompletedFormsPath
to work that way, but not the DocumentTemplateFile. I thought maybe because
the path/file name has a space in it, but I modified the file (putting in an
underscore instead of the space) and it still didn't work.
You would think this shouldn't be as hard as it is.
> > Can you establish variables and have them accessible to all macros within
> > a
[quoted text clipped - 42 lines]
> Public Const CompletedFormsPath As String =
> "G:\GS-220\SLATE\CORRECTION_SHEETS\CompletedForms\"
Jonathan West - 02 Aug 2007 17:46 GMT
> Johnathan,
>
> I get an 'Invalid Argument' when I use the constant:
> Public Sub DefinePaths()
>
[quoted text clipped - 5 lines]
> "G:\GS-220\SLATE\CORRECTION_SHEETS\CompletedForms\"
> End Sub
You missed part of what I said. Public declarations are not placed inside
any routine. Place the declarations *before the first routine* in a module.
> Sub AUTONEW()
>
[quoted text clipped - 11 lines]
> property,
> would that work?
It would work, but there is no particular need to do it that way. Just
declare them outside routines.
> I was able to get the DataSourceFile and CompletedFormsPath
> to work that way, but not the DocumentTemplateFile. I thought maybe
[quoted text clipped - 4 lines]
>
> You would think this shouldn't be as hard as it is.
Its easy once you know how! :-)

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup