ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compile error for macros (https://www.excelbanter.com/excel-programming/301790-compile-error-macros.html)

michael

Compile error for macros
 
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?

mudraker[_267_]

Compile error for macros
 
This line of code should be on a single line


Sheet1.PageSetup.LeftFooter = ActiveWorkbook.FullNam

--
Message posted from http://www.ExcelForum.com


Jim Cone

Compile error for macros
 
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

"MICHAEL" wrote in message ...
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?



All times are GMT +1. The time now is 11:13 AM.

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