开发者

MS-Project files are accumulating on the task bar

Currently I have a program that takes as input a folder that contains .MPP file (Microsoft Project files), reformats the information and splits out the each convertered file into a new folder (Selected by the user).

The problem is that with each file that it processes the application is seen from the task bar and accumulates. So if I had N files in the directory there will be N project files opened. Anyone know how to keep these tasks hidden? Originally I thought the visible property was set to t开发者_Go百科rue by default, but after explicitly setting it to false I still get the problem.

projectApp.Visible = false;

Here is the pseudocode for my application

For each File in Folder
    Open File
    Format File
    Save As File
End for each
Quit application

Here are the open and save parameters I have passed (If that helps at all) Open:

projectApp.FileOpen(txtBrowse.Text + @"\" + file.Name, false, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, PjPoolOpen.pjDoNotOpenPool, missingValue, missingValue, true, missingValue);

Saving:

projectApp.FileSaveAs(txtSave.Text + @"\" + file.Name, PjFileFormat.pjMPP, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue);

and missingValue is Type.Missing

Feel free to request any additional information and thanks for the help!

P.S I'm using the Microsoft.Office.Interop.MSProject reference


I'm not fluent with that interface, but it seems like you'd want to do a FileClose as the last line of the loop, right after the FileSaveAs.


I had the same problem as you. Initially, I couldn't save the file. But after testing the code out again in another directory, it worked, but it didn't close the project file like yours. The solution is quite easy as mentioned by the other guy. You forgot to close the file. Close the file with the following line:

projectApp.FileClose(PjSaveType.pjSave, missingValue);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜