Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Q: break link and save

Hello,
I am using the following code to create workbook for each sheet that I have
in my main workbook. It works fine, my problem is links. Sheets have links to
other files and I need to get rid of them by keeping the values. Is there any
way I can break links and save the current values during SaveAs below?

Sub test()
Dim a As Integer
Dim wb As Workbook
Application.ScreenUpdating = False
For a = 1 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Sheets(a).Copy
Set wb = ActiveWorkbook
wb.SaveAs "C:\Tmp\" & wb.Sheets(1).Name & ".xls"
wb.Close False
Set wb = Nothing
Next a
Application.ScreenUpdating = True
End Sub

Thanks,
Jim.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default break link and save

Jim -

Check out the LinkSources method and its example in the help files. It
looks like you could use that on your wb object to get the links and then
use BreakLink to break the links. The BreakLink method's example seems even
closee to what you want...

HTH

James Cox



"JIM.H." wrote in message
...
Hello,
I am using the following code to create workbook for each sheet that I

have
in my main workbook. It works fine, my problem is links. Sheets have links

to
other files and I need to get rid of them by keeping the values. Is there

any
way I can break links and save the current values during SaveAs below?

Sub test()
Dim a As Integer
Dim wb As Workbook
Application.ScreenUpdating = False
For a = 1 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Sheets(a).Copy
Set wb = ActiveWorkbook
wb.SaveAs "C:\Tmp\" & wb.Sheets(1).Name & ".xls"
wb.Close False
Set wb = Nothing
Next a
Application.ScreenUpdating = True
End Sub

Thanks,
Jim.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default break link and save

I am new in this. which help file has LinkSources. Excel help does not show it.


"James Cox" wrote:

Jim -

Check out the LinkSources method and its example in the help files. It
looks like you could use that on your wb object to get the links and then
use BreakLink to break the links. The BreakLink method's example seems even
closee to what you want...

HTH

James Cox



"JIM.H." wrote in message
...
Hello,
I am using the following code to create workbook for each sheet that I

have
in my main workbook. It works fine, my problem is links. Sheets have links

to
other files and I need to get rid of them by keeping the values. Is there

any
way I can break links and save the current values during SaveAs below?

Sub test()
Dim a As Integer
Dim wb As Workbook
Application.ScreenUpdating = False
For a = 1 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Sheets(a).Copy
Set wb = ActiveWorkbook
wb.SaveAs "C:\Tmp\" & wb.Sheets(1).Name & ".xls"
wb.Close False
Set wb = Nothing
Next a
Application.ScreenUpdating = True
End Sub

Thanks,
Jim.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default break link and save

go to the VBE and open the object browser. Search the Excel library for
LinkSources

It should return linkSources as an element of the Workbook Object. Click on
the linksources entry and hit the F1 key to get help.

--
Regards,
Tom Ogilvy

"JIM.H." wrote in message
...
I am new in this. which help file has LinkSources. Excel help does not

show it.


"James Cox" wrote:

Jim -

Check out the LinkSources method and its example in the help files. It
looks like you could use that on your wb object to get the links and

then
use BreakLink to break the links. The BreakLink method's example seems

even
closee to what you want...

HTH

James Cox



"JIM.H." wrote in message
...
Hello,
I am using the following code to create workbook for each sheet that I

have
in my main workbook. It works fine, my problem is links. Sheets have

links
to
other files and I need to get rid of them by keeping the values. Is

there
any
way I can break links and save the current values during SaveAs below?

Sub test()
Dim a As Integer
Dim wb As Workbook
Application.ScreenUpdating = False
For a = 1 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Sheets(a).Copy
Set wb = ActiveWorkbook
wb.SaveAs "C:\Tmp\" & wb.Sheets(1).Name & ".xls"
wb.Close False
Set wb = Nothing
Next a
Application.ScreenUpdating = True
End Sub

Thanks,
Jim.







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
Break a link between workbooks when there is no "break" option FruitNLoops Excel Discussion (Misc queries) 2 January 31st 09 05:16 AM
Link won't break dannyfreedom Excel Discussion (Misc queries) 1 July 28th 08 05:24 PM
Can Not Break a Link albertmb Excel Discussion (Misc queries) 3 June 20th 08 02:22 PM
break link Miri Excel Discussion (Misc queries) 2 April 9th 08 01:05 PM
Can't break my link thelees Excel Discussion (Misc queries) 0 February 4th 07 10:32 PM


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