01
using
System;
02
using
System.Collections.Generic;
03
using
System.Text;
04
using
Microsoft.Office.Interop.MSProject;
05
06
namespace
ConsoleApplication
07
{
08
class
Program
09
{
10
static
void
Main(
string
[] args)
11
{
12
Program pro =
new
Program();
13
pro.readMpp();
14
// pro.callMacro();
15
//pro.createMpp();
16
}
17
//調用mpp中定義的宏
18
public
void
callMacro()
19
{
20
Object missing = Type.Missing;
21
ApplicationClass prj =
new
ApplicationClass();
22
//打開mpp文件
23
prj.FileOpen(
"C:/Documents and Settings/Administrator/My Documents/test.mpp"
,
24
false
, missing, missing, missing, missing, missing, missing, missing,
25
missing, missing, PjPoolOpen.pjPoolReadWrite, missing, missing, missing, missing);
26
//調用名稱為testMacro
27
prj.Macro(
"testMacro"
);
28
//關閉,但不保存mpp