Tableを作成して文字を記述する
//Wordを操作するためのタイプライブラリを読みこむ(Word2000用)
#import "C:\Program Files\Microsoft Office 2000\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 2000\Office\Msword9.olb" rename("ExitWindows", "ExitWindowsDOC")
void CDoctblDlg::OnButton1()
{
using namespace Word;
_ApplicationPtr pDOC;
//Wordの起動
pDOC.CreateInstance(L"Word.Application");
pDOC->Visible = TRUE;
//新規 Word document を追加する
DocumentsPtr pDocuments = pDOC->GetDocuments();
_DocumentPtr pDocument = pDocuments->Add();
//Tableを作成
TablePtr pTable = pDOC->ActiveDocument->Tables->Add(pDocument->Range(),5,6);
//Tableへ文字を出力
pTable->Cell(2,2)->Range->Text = "Test Data";
AfxMessageBox("動作確認のために一時停止");
//Wordを閉じる
pDOC->Quit();
}