问题描述
您好。我正在寻找一种方法来自动将项目文件导出到.csv文件,而无需打开文件并使用另存为。我将拥有的所有文件都采用相同的格式,并将通过网络表单上传给我。目标是自动化
将它们保存到csv的过程,这样我就可以在我的SQL数据库中输入值,以便在我的VB应用程序中使用多个报告工具。有没有办法做到这一点?谢谢。
Hi. I am looking for a way to automatically export project files into .csv files with out having to open the files and use save as. All the files I will have are in the same exact format and will be uploaded to me through a web form. The goal is to automate the process to save them to a csv so I can enter values into my SQL database to use with multiple reporting tools in my VB application. Is there any way to do this? Thank you.
推荐答案
您需要编写代码来处理此要求。可以是MS项目或UI的插件,您可以在其中获取项目列表或作为插件的特定项目。您可以调用MS Project应用程序对象的Application.FileSaveAs方法,其中
基于formatID以.mpp,.csv,.xml等格式保存文件。
You will need to write code to handle this requirement. May be an addin to MS project or UI where you can get the list of the project or to a specific project as an addin . You can call MS Project application object's Application.FileSaveAs Method which saves the file in a desired format like .mpp, .csv, .xml etc based on the formatID.
FileSaveAs(Name,
Format, Backup, ReadOnly, TaskInformation, Filtered, Table, UserID, DatabasePassWord, FormatID, Map, Password, WriteResPassword, ClearBaseline, ClearActuals, ClearResourceRates, ClearFixedCosts, XMLName, ClearConfirmed)
作为一个宏:
As a macro:
Sub SaveFileAs() Application.Alerts = False Dim projLoc As String projLoc = "https://servername/PWA/worspacename/backupDocLib/" + ActiveProject.Name + "-" + Now() FileSaveAs Name:=projLoc, FormatID:="MSProject.MPP" FileCloseEx pjSave, False, True Application.Alerts = TrueEnd Sub
希望有所帮助。
这篇关于从项目自动导出到CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!