Thread: Removing Links
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Removing Links

The best would be to avoid the problem.

Without knowing how you induced the links, it is hard to say how to avoid
it, but one way would be to make a copy of the complete file, then remove
what you don't want in the new file.

ActiveWorkbook.SaveCopyAs "newname.xls"
workbooks.Open NewName.xls
Application.DisplayAlerts = False
activeworkbook.Worksheets(3).Delete
Application.DisplayAlerts = True


Or copy all the sheets you want to copy at one time

Worksheets(Array("Sheet1","Sheet3","sheet5")).Copy

as long as they don't refer to any sheets that were not copies, then the
links would not be created.

Otherwise, turn on the macro recorder while you change the source of the
links and use that code as your start.

--
Regards,
Tom Ogilvy




"rothco" wrote in
message ...

Thanks for that

But how do I do it in VBA so the user does not have to manually update
the links?

Roy


--
rothco
------------------------------------------------------------------------
rothco's Profile:

http://www.excelforum.com/member.php...o&userid=31492
View this thread: http://www.excelforum.com/showthread...hreadid=511707