Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default BreakLinks method works when Stepping Through but not when Running!

Dear All,
I have a worksheet with several graphs in it.
The sheet gets copied to create a new workbook then I've atempted to
Breaklinks to the original workbook by using the following code
(straight out of the online help!!).
If I step through the macro then it seems like the links are broken,
but if I just let it run then when I open the workbook (which has been
programmatically attached to and outlook mailitem) then the links still
exist and haven't been broken!!

Any help greatly appreciated,
Jason.


Dim astrLinks As Variant
' Define variable as an Excel link type.
astrLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLi nks)
' Break the first link in the active workbook.
ActiveWorkbook.BreakLink Name:=astrLinks(1), Type:=xlLinkTypeExcelLinks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default BreakLinks method works when Stepping Through but not when Running

It worked for me (like you indicate it does for you) for an unattached
workbook. Did you save the workbook after breaking the link?

I don't know your situation, but I would make all changes before doing the
attachment. If you want to preserve the original, then make a copy (work
with it), make the changes, do the attachment, send the email, delete the
copy.

--
Regards,
Tom Ogilvy


"WhytheQ" wrote:

Dear All,
I have a worksheet with several graphs in it.
The sheet gets copied to create a new workbook then I've atempted to
Breaklinks to the original workbook by using the following code
(straight out of the online help!!).
If I step through the macro then it seems like the links are broken,
but if I just let it run then when I open the workbook (which has been
programmatically attached to and outlook mailitem) then the links still
exist and haven't been broken!!

Any help greatly appreciated,
Jason.


Dim astrLinks As Variant
' Define variable as an Excel link type.
astrLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLi nks)
' Break the first link in the active workbook.
ActiveWorkbook.BreakLink Name:=astrLinks(1), Type:=xlLinkTypeExcelLinks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default BreakLinks method works when Stepping Through but not when Running

Thanks are due, as per usual Tom! ... the little line
"Activeworkbook.Save" has made all the difference.

Jason


Tom Ogilvy wrote:

It worked for me (like you indicate it does for you) for an unattached
workbook. Did you save the workbook after breaking the link?

I don't know your situation, but I would make all changes before doing the
attachment. If you want to preserve the original, then make a copy (work
with it), make the changes, do the attachment, send the email, delete the
copy.

--
Regards,
Tom Ogilvy


"WhytheQ" wrote:

Dear All,
I have a worksheet with several graphs in it.
The sheet gets copied to create a new workbook then I've atempted to
Breaklinks to the original workbook by using the following code
(straight out of the online help!!).
If I step through the macro then it seems like the links are broken,
but if I just let it run then when I open the workbook (which has been
programmatically attached to and outlook mailitem) then the links still
exist and haven't been broken!!

Any help greatly appreciated,
Jason.


Dim astrLinks As Variant
' Define variable as an Excel link type.
astrLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLi nks)
' Break the first link in the active workbook.
ActiveWorkbook.BreakLink Name:=astrLinks(1), Type:=xlLinkTypeExcelLinks



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
Stepping through gives different result than running Gregg Roberts Excel Programming 10 September 22nd 06 08:42 PM
BreakLinks method doesn't work. Gop Excel Discussion (Misc queries) 0 September 1st 05 12:27 PM
Error Message When running code but not stepping through it. Jared Excel Programming 4 November 16th 04 07:09 PM
VBA Code works by stepping through, not by running JbL Excel Programming 7 November 4th 04 02:49 PM
Stepping through code gives different results than running it! Simon White Excel Programming 2 November 13th 03 09:44 PM


All times are GMT +1. The time now is 12:12 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"