使用SSIS脚本任务刷新Excel

编程入门 行业动态 更新时间:2024-10-27 08:28:17
本文介绍了使用SSIS脚本任务刷新Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个Excel文件,该文件从数据库表中获取外部数据.我需要自动刷新文件并通过电子邮件发送.我打算使用SSIS脚本任务来运行一些VB脚本,该脚本将打开文件,刷新数据,保存并关闭(显然不启动应用程序).然后我将使用电子邮件任务通过电子邮件发送文件.我需要的是刷新文件并在VB或C#中完全无效的脚本,我必须问是否有人有一个脚本可以执行此操作,并且可以为我的文件进行自定义并在脚本任务中使用. 我将不胜感激! 多谢, 弗拉德

I have an Excel file that gets external data from database table. I need to refresh the file automatically and email it. I intend to use SSIS script task to run some VB script that would open the file, refresh data, save and close (obviously without bringing up the application). then I'll use email task to send the file by email. All I need is the script that refreshes the file and being total noob in VB or C# I have to ask if anyone has a script that does that lying around and which I could customize for my file and use in my script task. I'll appreciate any hints! thanks a lot, Vlad

推荐答案

希望这就是您想要的

' Create an Excel instance Dim oExcel Set oExcel = CreateObject("Excel.Application") ' Disable Excel UI elements oExcel.Visible = True oExcel.DisplayAlerts = False oExcel.AskToUpdateLinks = False oExcel.AlertBeforeOverwriting = False Set oWorkbook = oExcel.Workbooks.Open("absolute path to your file") oWorkbook.RefreshAll oWorkbook.Save oExcel.Quit Set oWorkbook = Nothing Set oExcel = Nothing

更多推荐

使用SSIS脚本任务刷新Excel

本文发布于:2023-11-28 15:53:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643030.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   SSIS   Excel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!