Compile error for macros

  • Thread starter Thread starter MICHAEL
  • Start date Start date
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?
 
This line of code should be on a single line


Sheet1.PageSetup.LeftFooter = ActiveWorkbook.FullNam
 
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
 

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

Back
Top