Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Update links/save = false

Greetings.

I'm trying to put together an Excel workbook that takes data from
every workbook in a certain folder. So far I have the code below which
works perfectly.

However, I have been unable to find a way to automatically choose
"Don't Update" to the update links box, or "No" to the "Do you want to
save?" box.

I've found a few solutions but can't seem to slot them in with the
code properly. Any help would be appreciated.



Sub CopyRangeValues()
Application.DisplayAlerts = False
Dim basebook As Workbook
Dim mybook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim i As Long
Dim a As Long
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.LookIn = "G:\New Folder"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
Set basebook = ThisWorkbook
rnum = 2
For i = 1 To .FoundFiles.Count

Set mybook = Workbooks.Open(.FoundFiles(i))


Set sourceRange = mybook.Worksheets("Access
Data").Range("a2:k336")
a = sourceRange.Rows.Count
With sourceRange
Set destrange = basebook.Worksheets(1).Cells(rnum,
1). _

Resize(.Rows.Count, .Columns.Count)
End With
destrange.Value = sourceRange.Value
mybook.Close
rnum = i * a + 1
Next i
End If
End With
Application.ScreenUpdating = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Update links/save = false

Are you maybe looking for

mybook.Close SaveChanges: = FALSE

--
HTH,
Barb Reinhardt




"Andy" wrote:

Greetings.

I'm trying to put together an Excel workbook that takes data from
every workbook in a certain folder. So far I have the code below which
works perfectly.

However, I have been unable to find a way to automatically choose
"Don't Update" to the update links box, or "No" to the "Do you want to
save?" box.

I've found a few solutions but can't seem to slot them in with the
code properly. Any help would be appreciated.



Sub CopyRangeValues()
Application.DisplayAlerts = False
Dim basebook As Workbook
Dim mybook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim i As Long
Dim a As Long
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.LookIn = "G:\New Folder"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
Set basebook = ThisWorkbook
rnum = 2
For i = 1 To .FoundFiles.Count

Set mybook = Workbooks.Open(.FoundFiles(i))


Set sourceRange = mybook.Worksheets("Access
Data").Range("a2:k336")
a = sourceRange.Rows.Count
With sourceRange
Set destrange = basebook.Worksheets(1).Cells(rnum,
1). _

Resize(.Rows.Count, .Columns.Count)
End With
destrange.Value = sourceRange.Value
mybook.Close
rnum = i * a + 1
Next i
End If
End With
Application.ScreenUpdating = True
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Update links/save = false

Barb,

That's perfect, thank you.

The major issue is the "Update Links" box though, any ideas on how to
make the code chose "Don't update" each time?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Update links/save = false

See the tips on this page
http://www.rondebruin.nl/copy3.htm

Add UpdateLinks:=0


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Andy" wrote in message ...
Barb,

That's perfect, thank you.

The major issue is the "Update Links" box though, any ideas on how to
make the code chose "Don't update" each time?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Update links/save = false

Ron,

I stumbled upon that link earlier and read through it, although I
couldn't find where to add the code for it to work.

Is there a way to easily slot this in?


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Update links/save = false

Nevermind, I found it through VBA help - as suggested on your link.

Thanks for the help!
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Update links/save = false

Hi Andy

Use
mybook = Workbooks.Open(.FoundFiles(i), UpdateLinks:=0)

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Andy" wrote in message ...
Ron,

I stumbled upon that link earlier and read through it, although I
couldn't find where to add the code for it to work.

Is there a way to easily slot this in?

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
Cannot Update Links Message is False but Always Appears [email protected] Excel Discussion (Misc queries) 0 April 20th 09 02:50 PM
Update Links on Save Barb Reinhardt Excel Discussion (Misc queries) 0 April 8th 08 02:06 PM
How do I save 2 linked spreadsheets and update links in formulae dlw Excel Discussion (Misc queries) 0 March 8th 07 09:36 PM
Save file with different name and dont update the links when opened again [email protected] Excel Discussion (Misc queries) 0 January 25th 07 09:09 PM
Save file with different name and dont update the links when opened again [email protected] Excel Discussion (Misc queries) 0 January 25th 07 09:09 PM


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