Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Macro to Break Links Before Saving Sheet

I tried to come up with a method to create a 'tear off sheet', which would
basically be a single summary sheet that has all relevant data for a series
of complicated calculations that are done with an Excel model. I tried the
following with the macro recorder on: right-click, copy sheet, New Book,
create a copy. Then, I saved the single worksheet to my C-drive. The
problem is that when the model recalculates, all the new data flows through
to the Summary sheet that I just created. In many instances this would be
perfectly fine, but in this instance, it is not fine because I want the
Summary sheet to be a static result of the analysis that was done on a
certain date at a certain time; I don't want the Summary sheet that is saved
to be updated each time the model is rerun because I will save a different
Summary sheet, with a different name, each time the model is run again.

Below is the code that I have now, but for some reason it doesn't allow me
to break the links between the model and the Summary sheet, when the Summary
sheet is saved.

Sheets("Summary").Select
Sheets("Summary").Copy
ActiveWorkbook.BreakLink Name:= _
"C:\Documents and Settings\laptop\Desktop\Reporting.xls" _
, Type:=xlExcelLinks
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\" & strFilename,
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

On Error Resume Next

Does anyone know how to use code to break those links to a single worksheet,
saved on the local drive, just before it is actually saved?

Regards,
Ryan---



--
RyGuy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Macro to Break Links Before Saving Sheet

I haven't used the BreakLink method - why not just copy and paste values?

However, reviewing BreakLink in the help file reveals that "Name" should
refer to the name of the link. Also, the LinkSources method for a workbook
returns an array of all of the link names in the workbook...
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"ryguy7272"

wrote in message
I tried to come up with a method to create a 'tear off sheet', which would
basically be a single summary sheet that has all relevant data for a series
of complicated calculations that are done with an Excel model. I tried the
following with the macro recorder on: right-click, copy sheet, New Book,
create a copy. Then, I saved the single worksheet to my C-drive. The
problem is that when the model recalculates, all the new data flows through
to the Summary sheet that I just created. In many instances this would be
perfectly fine, but in this instance, it is not fine because I want the
Summary sheet to be a static result of the analysis that was done on a
certain date at a certain time; I don't want the Summary sheet that is saved
to be updated each time the model is rerun because I will save a different
Summary sheet, with a different name, each time the model is run again.

Below is the code that I have now, but for some reason it doesn't allow me
to break the links between the model and the Summary sheet, when the Summary
sheet is saved.

Sheets("Summary").Select
Sheets("Summary").Copy
ActiveWorkbook.BreakLink Name:= _
"C:\Documents and Settings\laptop\Desktop\Reporting.xls" _
, Type:=xlExcelLinks
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\" & strFilename,
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
On Error Resume Next

Does anyone know how to use code to break those links to a single worksheet,
saved on the local drive, just before it is actually saved?
Regards,
Ryan---
--
RyGuy
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Macro to Break Links Before Saving Sheet

Well, because of the formatting, everything gets really screwed up if I try
to copy and paste to a new sheet. Also, there are some merged cells, and I
encountered some problems when I tried to paste the Summary sheet it to a new
worksheet. then right-click and create new sheet method works well, but I
have all those links in there and every time I rerun the model all the data
in the linked files gets updated...but it shouldn't be updated!! Can anyone
think of any other workarounds? Or, can anyone think of a way to use VBA to
break those links?

Regards,
Ryan---


--
RyGuy


"Jim Cone" wrote:

I haven't used the BreakLink method - why not just copy and paste values?

However, reviewing BreakLink in the help file reveals that "Name" should
refer to the name of the link. Also, the LinkSources method for a workbook
returns an array of all of the link names in the workbook...
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"ryguy7272"

wrote in message
I tried to come up with a method to create a 'tear off sheet', which would
basically be a single summary sheet that has all relevant data for a series
of complicated calculations that are done with an Excel model. I tried the
following with the macro recorder on: right-click, copy sheet, New Book,
create a copy. Then, I saved the single worksheet to my C-drive. The
problem is that when the model recalculates, all the new data flows through
to the Summary sheet that I just created. In many instances this would be
perfectly fine, but in this instance, it is not fine because I want the
Summary sheet to be a static result of the analysis that was done on a
certain date at a certain time; I don't want the Summary sheet that is saved
to be updated each time the model is rerun because I will save a different
Summary sheet, with a different name, each time the model is run again.

Below is the code that I have now, but for some reason it doesn't allow me
to break the links between the model and the Summary sheet, when the Summary
sheet is saved.

Sheets("Summary").Select
Sheets("Summary").Copy
ActiveWorkbook.BreakLink Name:= _
"C:\Documents and Settings\laptop\Desktop\Reporting.xls" _
, Type:=xlExcelLinks
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\" & strFilename,
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
On Error Resume Next

Does anyone know how to use code to break those links to a single worksheet,
saved on the local drive, just before it is actually saved?
Regards,
Ryan---
--
RyGuy

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Macro to Break Links Before Saving Sheet

Did you look at the help file as I suggested?
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)





"ryguy7272"
wrote in message
Well, because of the formatting, everything gets really screwed up if I try
to copy and paste to a new sheet. Also, there are some merged cells, and I
encountered some problems when I tried to paste the Summary sheet it to a new
worksheet. then right-click and create new sheet method works well, but I
have all those links in there and every time I rerun the model all the data
in the linked files gets updated...but it shouldn't be updated!! Can anyone
think of any other workarounds? Or, can anyone think of a way to use VBA to
break those links?
Regards,
Ryan---
--
RyGuy
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Macro to Break Links Before Saving Sheet

I just looked at the help menu right now.
I think that makes sense. I'll try a few ideas later.

Thanks for the look,
Ryan---

--
RyGuy


"Jim Cone" wrote:

Did you look at the help file as I suggested?
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)





"ryguy7272"
wrote in message
Well, because of the formatting, everything gets really screwed up if I try
to copy and paste to a new sheet. Also, there are some merged cells, and I
encountered some problems when I tried to paste the Summary sheet it to a new
worksheet. then right-click and create new sheet method works well, but I
have all those links in there and every time I rerun the model all the data
in the linked files gets updated...but it shouldn't be updated!! Can anyone
think of any other workarounds? Or, can anyone think of a way to use VBA to
break those links?
Regards,
Ryan---
--
RyGuy

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
Can't get Break Links macro to work... from last week (10/6) Steve Excel Worksheet Functions 0 October 13th 09 07:26 PM
Break Links using a macro problem merry_fay Excel Discussion (Misc queries) 0 July 31st 08 12:26 PM
Break Links Macro help... mydogpeanut Excel Programming 4 April 25th 07 03:46 PM
macro to savecopy as and break links schoolie Excel Programming 1 May 22nd 06 09:06 AM
Copy sheet - Break Links to Old Workbook - Retain Formula. Mr Anonymouse Setting up and Configuration of Excel 1 October 15th 05 01:00 AM


All times are GMT +1. The time now is 11:13 PM.

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

About Us

"It's about Microsoft Excel"