Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Print_Area link problem

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Print_Area link problem



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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Print_Area link problem

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





  #4   Report Post  
Posted to microsoft.public.excel.programming
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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link problem Leonard Lan Excel Worksheet Functions 4 June 3rd 08 06:03 AM
Excel: Blank Screen Stuck in Wierd Print_Area mode Shell E Excel Discussion (Misc queries) 1 December 8th 06 04:07 PM
Problem with link Runar Excel Worksheet Functions 1 January 13th 06 05:10 PM
protect print_area? Steven Excel Programming 1 April 22nd 04 11:32 PM
Print Ranges when Print_Area not set Dominic Robinson Excel Programming 1 September 11th 03 09:38 AM


All times are GMT +1. The time now is 09:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"