Unable to set the LeftFooter property of the PageSetup Class

S

Sierk

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
 
S

Sierk

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top