View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Print_Area link problem

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


"Scott" wrote:

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



"keepITcool" wrote in message
...


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


"Scott" wrote:

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