Print_Area link problem

S

Scott

Hi,

I'm having a problem with deleting a link using a macro. The link is a
"Print_Area" link to another workbook and I've used the code
"ActiveWorkbook.Names("Print_Area").Delete", but this doesn't seem to remove
the link.
But if I go to "Insert" menu of the workbook, select "Name - Define" select
the "Print_Area" name and delete it, this works, why?

I've also tried to delete all links from the workbook using the following
code:-

Dim nm As Object
For Each nm In ActiveWorkbook.Names
nm.Delete
Next

This seems to delete all links except for the "Print_Area"

Can someone please help,
Thanks
Best regards,
Scott
 
K

keepITcool

the Print_Area Name object's parent is the worksheet not the workbook.

Either
ActiveSheet.Names("Print_Area").Delete
Activeworkbook.Names("Sheet1!Print_Area").delete

OR
ActiveSheet.PageSetup.PrintArea = False



keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
S

Scott

Thanks for you reply,

But neither solution seemed to work.

The first
ActiveSheet.Names("Print_Area").Delete
Activeworkbook.Names("Sheet1!Print_Area").delete

popped up an error message
"Run-time error '10041:
Application-defined or object-defined error "

and the "ActiveSheet.PageSetup.PrintArea = False" doesn't remove the link.

Any ideas?

Thanks
Best regards,
Scott





the Print_Area Name object's parent is the worksheet not the workbook.

Either
ActiveSheet.Names("Print_Area").Delete
Activeworkbook.Names("Sheet1!Print_Area").delete

OR
ActiveSheet.PageSetup.PrintArea = False



keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
K

keepITcool

have you looked at the NAMES collection object?

Dim oNMS as names
set oNMS=activeworkbook.names
stop
'now open locals window in VBE and check..

what's the full name of that NameObject?

maybe the names in the file are damaged?

download Jan Karel Pieterse's NameManager addin
from http://www.bmsltd.ie/MVP/MVPPage.asp

to try and fix it.

if that's not working plse zip and email,
and I'll have a look.



keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 

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