Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Question about CreateOleObject

Hello,

I'm trying to create a program that replace a string in Microsoft Word Document.

For this I use this source code:

[code]//---------------------------------------------------------------------------

#include
#pragma hdrstop
#include
#include
#include "Ole.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

Variant WinWord, Docs, Doc;
String arquivo, prazo;
Word anoinic, mesinic, diainic,anofim, mesfim, diafim;
int subtrair;

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{


// Pega o nome do arquivo...
arquivo ="C:\Nome da Empresa.doc";

// Cria objeto principal de controle
WinWord = CreateOleObject("Word.Application");

//N
Sign In or Register to comment.