VBA ActiveWorkbook error more info

B

Bryce

After reading my own previous post, I realized that I
didn't include enough info. Lets try again...

I am trying to insert the filename with path in the footer
of an Excel 2000 workbook. I found the following macro
online at

http://support.microsoft.com/default.aspx?scid=kb;en-
us;Q213615.

this is the macro:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter =
ActiveWorkbook.FullName
End Sub

Whhen I first tried it, it worked fine. Now, whenever I
run a print command (preview or print worksheet), Visual
Basic gives me runtime error 50290 "Method 'FullName' of
Object '_Workbook' failed". When I first tried this
(maybe 6 months ago), it worked fine. It has stopped
working within the last couple of months. I can't pin it
down to any software changes.

I am on a Win 2000 system with Excel 2000. I know that
Office 2002 has the ability internally to do with 2000, it
must be done with a macro. Any ideas?

Thanks.
 
K

Ken Macksey

Hi

Works for me as long as it is entered on one line

Like this
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.FullName
End Sub


or like this with the line continuation character.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = _
ActiveWorkbook.FullName
End Sub



instead of like this

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter =
ActiveWorkbook.FullName
End Sub

HTH

KenM
 
B

Bryce

Thanks for the idea, but that's not the answer. The
window here is what forced the line break.

Bryce
 

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