新規PowerPointファイルを起動し、スライドを開く


//PowerPointを操作するためのタイプライブラリを読みこむ(PowerPoint2000用)
#import "C:\Program Files\Microsoft Office\Office\Mso9.dll" no_namespace rename("DocumentProperties", "DocumentPropertiesDOC")
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\Vbe6ext.olb" no_namespace
#import "C:\Program Files\Microsoft Office\Office\msppt9.olb"

void CPptnewslideDlg::OnButton1() 
{
	using namespace PowerPoint;
	_ApplicationPtr pPPT;

 	//PowerPointの起動
	pPPT.CreateInstance(L"PowerPoint.Application");
	pPPT->put_Visible(msoTrue);

	//新規 プレゼンテーション を追加する
	_PresentationPtr pPresentation = pPPT->Presentations->Add(msoTrue);

	//新規 スライド(空)を追加する
	pPresentation->Slides->Add(1, ppLayoutBlank);

	AfxMessageBox("動作確認のために一時停止");

	pPPT->Quit();	
}