TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Terry Higginbotham
NA
27
744
Refresh external datalinks in excel
Oct 23 2019 2:50 PM
The code below doesn't seem to refresh the data links. Does anyone see the issue?
Excel.Application xlApp2 =
new
Excel.Application();
xlApp2.DisplayAlerts =
false
;
xlApp2.Visible =
true
;
Excel.Workbook xlWorkbookt2 = xlApp.Workbooks.Open(@
"\\twg-jks-fs01\twg\Sales\Sales_Volume\Consolidated Sales Volume\Daily Note\Auto DOS Files\Go Live\TWG DOS - FY19 Std Rpts Automated HTML Ready.xlsx"
, 3,
false
, missing, missing, missing,
true
, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, missing,
true
, missing, missing, missing, missing, missing);
Excel._Worksheet xlWorksheet2 = xlWorkbookt2.Sheets[1];
foreach
(Microsoft.Office.Interop.Excel.WorkbookConnection conn
in
xlWorkbookt2.Connections) {
Console.WriteLine(conn.Name);
}
Excel.Range xlRange2 = xlWorksheet2.UsedRange;
object
misValue2 = System.Reflection.Missing.Value;
mWorkSheets = xlWorkbookt2.Worksheets;
string
text = File.ReadAllText(@
"\\twg-jks-fs01\twg\PublishedApps\DSN\DBTemplate.txt"
, Encoding.UTF8);
string
buttons =
string
.Empty;
string
frames =
string
.Empty;
int
cntr = 0;
try
{
xlWorkbookt2.RefreshAll();
System.Threading.Thread.Sleep(60000);
xlApp2.Application.CalculateUntilAsyncQueriesDone();
xlWorkbookt2.Save();
}
catch
(Exception ex) {
Console.WriteLine(
"failed Refreshing XLSX Links 2"
);
}
Reply
Answers (
0
)
how to split string in c#
Chat with customer support functionality in xamarin froms ap