Compile error for macros

M

MICHAEL

I am trying to create a macros to enter the filepath in
the footer of an excel document. Here is what MS Office's
site said to create:

Sub UpdateFooter()
Sheet1.PageSetup.LeftFooter=
ActiveWorkbook.FullName
End Sub

When I do this I get a compile error expected:expression.
What am I doing wrong?
 
M

mudraker

This line of code should be on a single line


Sheet1.PageSetup.LeftFooter = ActiveWorkbook.FullNam
 
J

Jim Cone

Michael,

The second and third line should be one line...
Sheet1.PageSetup.LeftFooter = ActiveWorkbook.FullName

When a line of code is split up, a line continuation character is needed.
That would be a space followed by the underscore " _" (without the quote marks).

Using the above the code line would look like...
Sheet1.PageSetup.LeftFooter = _
ActiveWorkbook.FullName

Regards,
Jim Cone
San Francisco, CA
 
Top