Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Why macro cannot refreshall?

Does anyone have any suggestions on why macro cannot refresh all link?
On file.xls, there are import external links on many worksheets, which will
automatically update all links once it is opened, but when I use a macro to
open this worksheets, the worksheet does not update the import external links
at all. Even though, the code .RefreshAll is included, this macro will close
this file, but the links do not update, does anyone have any suggestions why
RefreshAll coding does not perform?
Thanks in advance for any suggestions
Eric

Public Sub UpdatingLists2()

Dim WkbkName As String
Dim wkbk As Workbook
On Error Resume Next

WkbkName = "D:\Documents\file.xls"

Set wkbk = Nothing
On Error Resume Next

Set wkbk = Workbooks.Open(Filename:=WkbkName, UpdateLinks:=3)
On Error GoTo 0

With wkbk
.RefreshAll
.Close savechanges:=True
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Why macro cannot refreshall?

hi
it is to may understanding that the refreshall command applies to query
tables and refresh all external querys that have their background query
property set to true.
see vb help on refresh all.
links are updated. see this site...
http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx

regards
FSt1

"Eric" wrote:

Does anyone have any suggestions on why macro cannot refresh all link?
On file.xls, there are import external links on many worksheets, which will
automatically update all links once it is opened, but when I use a macro to
open this worksheets, the worksheet does not update the import external links
at all. Even though, the code .RefreshAll is included, this macro will close
this file, but the links do not update, does anyone have any suggestions why
RefreshAll coding does not perform?
Thanks in advance for any suggestions
Eric

Public Sub UpdatingLists2()

Dim WkbkName As String
Dim wkbk As Workbook
On Error Resume Next

WkbkName = "D:\Documents\file.xls"

Set wkbk = Nothing
On Error Resume Next

Set wkbk = Workbooks.Open(Filename:=WkbkName, UpdateLinks:=3)
On Error GoTo 0

With wkbk
.RefreshAll
.Close savechanges:=True
End With

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Why macro cannot refreshall?

Thank you very much for suggestions
So how can I modify existing code to add xlUpdateLinksAlways option to
perform refreshAll?
Do you have any suggestions?
Thanks in advance for any suggestions
Eric

"FSt1" wrote:

hi
it is to may understanding that the refreshall command applies to query
tables and refresh all external querys that have their background query
property set to true.
see vb help on refresh all.
links are updated. see this site...
http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx

regards
FSt1

"Eric" wrote:

Does anyone have any suggestions on why macro cannot refresh all link?
On file.xls, there are import external links on many worksheets, which will
automatically update all links once it is opened, but when I use a macro to
open this worksheets, the worksheet does not update the import external links
at all. Even though, the code .RefreshAll is included, this macro will close
this file, but the links do not update, does anyone have any suggestions why
RefreshAll coding does not perform?
Thanks in advance for any suggestions
Eric

Public Sub UpdatingLists2()

Dim WkbkName As String
Dim wkbk As Workbook
On Error Resume Next

WkbkName = "D:\Documents\file.xls"

Set wkbk = Nothing
On Error Resume Next

Set wkbk = Workbooks.Open(Filename:=WkbkName, UpdateLinks:=3)
On Error GoTo 0

With wkbk
.RefreshAll
.Close savechanges:=True
End With

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Why macro cannot refreshall?

Hi Eric,

Not certain the following will do what you want. Just FYI the first part
should identify the links and the second part should update them.

I will be interested in how it goes.

Sub UpDatingLinks()
Dim aLinks As Variant
Dim i As Long

aLinks = ActiveWorkbook.LinkSources
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
MsgBox "Link " & i & ":" & Chr(13) & aLinks(i)
Next i
End If

ThisWorkbook.UpdateLink Name:=ThisWorkbook.LinkSources

End Sub

--
Regards,

OssieMac


"Eric" wrote:

Thank you very much for suggestions
So how can I modify existing code to add xlUpdateLinksAlways option to
perform refreshAll?
Do you have any suggestions?
Thanks in advance for any suggestions
Eric

"FSt1" wrote:

hi
it is to may understanding that the refreshall command applies to query
tables and refresh all external querys that have their background query
property set to true.
see vb help on refresh all.
links are updated. see this site...
http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx

regards
FSt1

"Eric" wrote:

Does anyone have any suggestions on why macro cannot refresh all link?
On file.xls, there are import external links on many worksheets, which will
automatically update all links once it is opened, but when I use a macro to
open this worksheets, the worksheet does not update the import external links
at all. Even though, the code .RefreshAll is included, this macro will close
this file, but the links do not update, does anyone have any suggestions why
RefreshAll coding does not perform?
Thanks in advance for any suggestions
Eric

Public Sub UpdatingLists2()

Dim WkbkName As String
Dim wkbk As Workbook
On Error Resume Next

WkbkName = "D:\Documents\file.xls"

Set wkbk = Nothing
On Error Resume Next

Set wkbk = Workbooks.Open(Filename:=WkbkName, UpdateLinks:=3)
On Error GoTo 0

With wkbk
.RefreshAll
.Close savechanges:=True
End With

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Why macro cannot refreshall?

Thank anyone for any suggestions
I get no idea what it is that
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric

"OssieMac" wrote:

Hi Eric,

Not certain the following will do what you want. Just FYI the first part
should identify the links and the second part should update them.

I will be interested in how it goes.

Sub UpDatingLinks()
Dim aLinks As Variant
Dim i As Long

aLinks = ActiveWorkbook.LinkSources
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
MsgBox "Link " & i & ":" & Chr(13) & aLinks(i)
Next i
End If

ThisWorkbook.UpdateLink Name:=ThisWorkbook.LinkSources

End Sub

--
Regards,

OssieMac


"Eric" wrote:

Thank you very much for suggestions
So how can I modify existing code to add xlUpdateLinksAlways option to
perform refreshAll?
Do you have any suggestions?
Thanks in advance for any suggestions
Eric

"FSt1" wrote:

hi
it is to may understanding that the refreshall command applies to query
tables and refresh all external querys that have their background query
property set to true.
see vb help on refresh all.
links are updated. see this site...
http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx

regards
FSt1

"Eric" wrote:

Does anyone have any suggestions on why macro cannot refresh all link?
On file.xls, there are import external links on many worksheets, which will
automatically update all links once it is opened, but when I use a macro to
open this worksheets, the worksheet does not update the import external links
at all. Even though, the code .RefreshAll is included, this macro will close
this file, but the links do not update, does anyone have any suggestions why
RefreshAll coding does not perform?
Thanks in advance for any suggestions
Eric

Public Sub UpdatingLists2()

Dim WkbkName As String
Dim wkbk As Workbook
On Error Resume Next

WkbkName = "D:\Documents\file.xls"

Set wkbk = Nothing
On Error Resume Next

Set wkbk = Workbooks.Open(Filename:=WkbkName, UpdateLinks:=3)
On Error GoTo 0

With wkbk
.RefreshAll
.Close savechanges:=True
End With



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Why macro cannot refreshall?

Hi Eric,

My apologies. I thought you would know how to translate it into your code.
Here is your code with the update links code included.

As I said before I will be interested in how it goes.

Public Sub UpdatingLists2()

Dim WkbkName As String
Dim wkbk As Workbook
On Error Resume Next

WkbkName = "D:\Documents\file.xls"

Set wkbk = Nothing
On Error Resume Next

Set wkbk = Workbooks.Open(Filename:=WkbkName, UpdateLinks:=3)
On Error GoTo 0

wkbk.UpdateLink Name:=wkbk.LinkSources

wkbk.Close savechanges:=True

--
Regards,

OssieMac

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
ActiveWorkbook.RefreshAll teepee[_3_] Excel Programming 0 November 11th 08 02:11 PM
how do i get the "RefreshAll" method to work in a macro sloan[_2_] Excel Programming 4 August 2nd 07 08:24 PM
ActiveWorkbook.RefreshAll toosie Excel Programming 1 February 16th 05 09:55 AM
Force Macro to wait till Refreshall is done NCSU_madman[_2_] Excel Programming 0 November 10th 04 05:36 PM
Force Macro to wait till Refreshall is done NCSU_madman Excel Programming 3 November 10th 04 04:39 PM


All times are GMT +1. The time now is 12:34 AM.

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"