View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
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