ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unable to set the LeftFooter property of the PageSetup Class (https://www.excelbanter.com/excel-programming/425000-unable-set-leftfooter-property-pagesetup-class.html)

Sierk

Unable to set the LeftFooter property of the PageSetup Class
 
When running my macro I get the above mentioned Run-time error '1004'. The
interesting thing is that when I assign the save variable that causes the
error for the LeftFooter to the RightFooter the error goes away. Does anyone
know why, and/or how to circumvent this issue? (code below)

Set myData = New DataObject
myData.GetFromClipboard
vPath = myData.GetText(1)

'While the right most character is a Paragraph marker or a carriage return
While Asc(Right(vPath, 1)) = 10 Or Asc(Right(vPath, 1)) = 13
'remove the paragraph marker
vPath = Mid(vPath, 1, Len(vPath) - 1)
Wend

vFont = "&""Times New Roman,Regular""&8"
vFile = " &F"
vCR = Chr(13)
vName = "CompanyName"

vLeftFooter = vFont & vPath & vFile & vCR & "&D"
vCenterFooter = vFont & "&P"
vRightFooter = vFont & vName
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.AlignMarginsHeaderFooter = False
.LeftFooter = vLeftFooter
.CenterFooter = vCenterFooter
.RightFooter = vLeftFooter
End With

--
Sierk

JLGWhiz[_2_]

Unable to set the LeftFooter property of the PageSetup Class
 
Worked OK for me.


"Sierk" wrote in message
...
When running my macro I get the above mentioned Run-time error '1004'.
The
interesting thing is that when I assign the save variable that causes the
error for the LeftFooter to the RightFooter the error goes away. Does
anyone
know why, and/or how to circumvent this issue? (code below)

Set myData = New DataObject
myData.GetFromClipboard
vPath = myData.GetText(1)

'While the right most character is a Paragraph marker or a carriage
return
While Asc(Right(vPath, 1)) = 10 Or Asc(Right(vPath, 1)) = 13
'remove the paragraph marker
vPath = Mid(vPath, 1, Len(vPath) - 1)
Wend

vFont = "&""Times New Roman,Regular""&8"
vFile = " &F"
vCR = Chr(13)
vName = "CompanyName"

vLeftFooter = vFont & vPath & vFile & vCR & "&D"
vCenterFooter = vFont & "&P"
vRightFooter = vFont & vName
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.AlignMarginsHeaderFooter = False
.LeftFooter = vLeftFooter
.CenterFooter = vCenterFooter
.RightFooter = vLeftFooter
End With

--
Sierk




Sierk

Unable to set the LeftFooter property of the PageSetup Class
 
Thanks, must have been Tuesday, a full moon, or perhaps there was something
in my coffee. Now it works for me too, even though I have no idea why it
didn't work yesterday and why it does work today. Go figure.
--
Sierk


"JLGWhiz" wrote:

Worked OK for me.


"Sierk" wrote in message
...
When running my macro I get the above mentioned Run-time error '1004'.
The
interesting thing is that when I assign the save variable that causes the
error for the LeftFooter to the RightFooter the error goes away. Does
anyone
know why, and/or how to circumvent this issue? (code below)

Set myData = New DataObject
myData.GetFromClipboard
vPath = myData.GetText(1)

'While the right most character is a Paragraph marker or a carriage
return
While Asc(Right(vPath, 1)) = 10 Or Asc(Right(vPath, 1)) = 13
'remove the paragraph marker
vPath = Mid(vPath, 1, Len(vPath) - 1)
Wend

vFont = "&""Times New Roman,Regular""&8"
vFile = " &F"
vCR = Chr(13)
vName = "CompanyName"

vLeftFooter = vFont & vPath & vFile & vCR & "&D"
vCenterFooter = vFont & "&P"
vRightFooter = vFont & vName
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.AlignMarginsHeaderFooter = False
.LeftFooter = vLeftFooter
.CenterFooter = vCenterFooter
.RightFooter = vLeftFooter
End With

--
Sierk






All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com