S
SteveDB1
Howdie all.
I have a macro that I've made based on a recorded macro.
It sets the headers, and footers of a worksheet.
I've been able to set it up so that it inputs the digits of the workbook's
name (I specifically did not want to use &[file]).
At this point, I was thinking that I'd like to use the file name as a basis
to set one more element.
I.e.,
MyClmVar=fname 'already set up
SSide = "P.11489, C. 4827" 'newcomer
here's what I have so far.
-----------------------------
Sub FooterArray()
Dim SSide As String
Dim myFooter(231 To 266) As String
Dim fname As String
Dim fname1 As String
Dim MyClmVar As String
SSide = " P.11489, C.4827"
fname = ActiveWorkbook.Name 'this looks at the existing file's name
'remove extension
fname = Left(fname, InStr(fname, ".") - 1)
MyClmVar = fname
fname1 = Right(fname, InStr(fname, "-") - 1) 'removes everything except last 3
'digits of file name
'this next next part is what I am having trouble with.
'Based on the watch's that I've set, myFooter never contains any values.
'thus my question here becomes-- how can I set a specific list of values--
from 231
'through 266 inclusive to be the values for myFooter?
'I.e., myfooter(231) has the value 231, etc.... through to myfooter(266) has
the
'value 266.
'As I'm specifically interested in comparing the fname1 to the value of
myfooter(i)
'for my if test.
If fname1 Like ["myFooter()"] Then
With ActiveSheet.PageSetUp
.CenterFooter = "&""Arial,Bold""&14 " & MyClmVar & SSide
End With
'the balance of this works great.
Else
With ActiveSheet.PageSetUp
.CenterFooter = "&""Arial,Bold""&14 " & MyClmVar
End With
End If
End Sub
Your helps are appreciated.
I have a macro that I've made based on a recorded macro.
It sets the headers, and footers of a worksheet.
I've been able to set it up so that it inputs the digits of the workbook's
name (I specifically did not want to use &[file]).
At this point, I was thinking that I'd like to use the file name as a basis
to set one more element.
I.e.,
MyClmVar=fname 'already set up
SSide = "P.11489, C. 4827" 'newcomer
here's what I have so far.
-----------------------------
Sub FooterArray()
Dim SSide As String
Dim myFooter(231 To 266) As String
Dim fname As String
Dim fname1 As String
Dim MyClmVar As String
SSide = " P.11489, C.4827"
fname = ActiveWorkbook.Name 'this looks at the existing file's name
'remove extension
fname = Left(fname, InStr(fname, ".") - 1)
MyClmVar = fname
fname1 = Right(fname, InStr(fname, "-") - 1) 'removes everything except last 3
'digits of file name
'this next next part is what I am having trouble with.
'Based on the watch's that I've set, myFooter never contains any values.
'thus my question here becomes-- how can I set a specific list of values--
from 231
'through 266 inclusive to be the values for myFooter?
'I.e., myfooter(231) has the value 231, etc.... through to myfooter(266) has
the
'value 266.
'As I'm specifically interested in comparing the fname1 to the value of
myfooter(i)
'for my if test.
If fname1 Like ["myFooter()"] Then
With ActiveSheet.PageSetUp
.CenterFooter = "&""Arial,Bold""&14 " & MyClmVar & SSide
End With
'the balance of this works great.
Else
With ActiveSheet.PageSetUp
.CenterFooter = "&""Arial,Bold""&14 " & MyClmVar
End With
End If
End Sub
Your helps are appreciated.