Error with OLE server

P

Perry

Try to replace
Word = CreateOleObject("Word.Application.8");

by
Word = CreateOleObject("Word.Application");

Krgrds,
Perry

Hello,
I am working with OLE server using C++ Builder 6.0, the code is the following:

{
Variant Word, Document, Table, Cell;
int RowCount, ColCount;

Word = CreateOleObject("Word.Application.8");
Word.OlePropertySet("Visible", true);
Word.OlePropertyGet("Documents").OleProcedure("Add");
Document = Word.OlePropertyGet("Documents").OleFunction("Item", 1);
Table = Document.OlePropertyGet("Tables").OleFunction("Add", Document.OleFunction("Range", 0, 0), 5, 5);
RowCount = Table.OlePropertyGet("Rows").OlePropertyGet("Count");
ColCount = Table.OlePropertyGet("Columns").OlePropertyGet("Count");
for (int i=1; i <=RowCount; i++)
for(int j=1; j <=ColCount; j++) {
Cell = Table.OleFunction("Cell", i, j);
Cell.OlePropertyGet("Range").OleProcedure("InsertAfter", WideString(IntToStr(i)) + WideString("-") + WideString(IntToStr(j)));
}
Document.OleProcedure("SaveAs", ChangeFileExt(Application->ExeName, ".doc"));
Word.OleProcedure("Quit");
}


Under Windows XP Home Edition with Microsoft Word 2003 Standart Edition for Students and Teachers the Application gets an error
"Exception occured". Under Windows 2000 and Windows XP Pro with Microsoft Word 2003 everything is normal. What can be the reason?
 
A

Aleksander

Hello,
I am working with OLE server using C++ Builder 6.0, the code is the following:

{
Variant Word, Document, Table, Cell;
int RowCount, ColCount;

Word = CreateOleObject("Word.Application.8");
Word.OlePropertySet("Visible", true);
Word.OlePropertyGet("Documents").OleProcedure("Add");
Document = Word.OlePropertyGet("Documents").OleFunction("Item", 1);
Table = Document.OlePropertyGet("Tables").OleFunction("Add", Document.OleFunction("Range", 0, 0), 5, 5);
RowCount = Table.OlePropertyGet("Rows").OlePropertyGet("Count");
ColCount = Table.OlePropertyGet("Columns").OlePropertyGet("Count");
for (int i=1; i <=RowCount; i++)
for(int j=1; j <=ColCount; j++) {
Cell = Table.OleFunction("Cell", i, j);
Cell.OlePropertyGet("Range").OleProcedure("InsertAfter", WideString(IntToStr(i)) + WideString("-") + WideString(IntToStr(j)));
}
Document.OleProcedure("SaveAs", ChangeFileExt(Application->ExeName, ".doc"));
Word.OleProcedure("Quit");
}


Under Windows XP Home Edition with Microsoft Word 2003 Standart Edition for Students and Teachers the Application gets an error
"Exception occured". Under Windows 2000 and Windows XP Pro with Microsoft Word 2003 everything is normal. What can be the reason?
 
P

Perry

Was worth a try.
Suggest you to address the apprpriate newsgroup for C++
or wait for someone else to help you in this newsgroup.

Good luck!
Perry
I tried this, it didn't help.
Try to replace
Word = CreateOleObject("Word.Application.8");

by
Word = CreateOleObject("Word.Application");

Krgrds,
Perry

Hello,
I am working with OLE server using C++ Builder 6.0, the code is the following:

{
Variant Word, Document, Table, Cell;
int RowCount, ColCount;

Word = CreateOleObject("Word.Application.8");
Word.OlePropertySet("Visible", true);
Word.OlePropertyGet("Documents").OleProcedure("Add");
Document = Word.OlePropertyGet("Documents").OleFunction("Item", 1);
Table = Document.OlePropertyGet("Tables").OleFunction("Add", Document.OleFunction("Range", 0, 0), 5, 5);
RowCount = Table.OlePropertyGet("Rows").OlePropertyGet("Count");
ColCount = Table.OlePropertyGet("Columns").OlePropertyGet("Count");
for (int i=1; i <=RowCount; i++)
for(int j=1; j <=ColCount; j++) {
Cell = Table.OleFunction("Cell", i, j);
Cell.OlePropertyGet("Range").OleProcedure("InsertAfter", WideString(IntToStr(i)) + WideString("-") + WideString(IntToStr(j)));
}
Document.OleProcedure("SaveAs", ChangeFileExt(Application->ExeName, ".doc"));
Word.OleProcedure("Quit");
}


Under Windows XP Home Edition with Microsoft Word 2003 Standart Edition for Students and Teachers the Application gets an error
"Exception occured". Under Windows 2000 and Windows XP Pro with Microsoft Word 2003 everything is normal. What can be the reason?
 
A

Aleksander

I tried this, it didn't help.
Try to replace
Word = CreateOleObject("Word.Application.8");

by
Word = CreateOleObject("Word.Application");

Krgrds,
Perry

Hello,
I am working with OLE server using C++ Builder 6.0, the code is the following:

{
Variant Word, Document, Table, Cell;
int RowCount, ColCount;

Word = CreateOleObject("Word.Application.8");
Word.OlePropertySet("Visible", true);
Word.OlePropertyGet("Documents").OleProcedure("Add");
Document = Word.OlePropertyGet("Documents").OleFunction("Item", 1);
Table = Document.OlePropertyGet("Tables").OleFunction("Add", Document.OleFunction("Range", 0, 0), 5, 5);
RowCount = Table.OlePropertyGet("Rows").OlePropertyGet("Count");
ColCount = Table.OlePropertyGet("Columns").OlePropertyGet("Count");
for (int i=1; i <=RowCount; i++)
for(int j=1; j <=ColCount; j++) {
Cell = Table.OleFunction("Cell", i, j);
Cell.OlePropertyGet("Range").OleProcedure("InsertAfter", WideString(IntToStr(i)) + WideString("-") + WideString(IntToStr(j)));
}
Document.OleProcedure("SaveAs", ChangeFileExt(Application->ExeName, ".doc"));
Word.OleProcedure("Quit");
}


Under Windows XP Home Edition with Microsoft Word 2003 Standart Edition for Students and Teachers the Application gets an error
"Exception occured". Under Windows 2000 and Windows XP Pro with Microsoft Word 2003 everything is normal. What can be the reason?
 
A

Aleksander

"Suggest you to address the apprpriate newsgroup for C++", could you name any one?
Was worth a try.
Suggest you to address the apprpriate newsgroup for C++
or wait for someone else to help you in this newsgroup.

Good luck!
Perry
I tried this, it didn't help.
Try to replace
Word = CreateOleObject("Word.Application.8");

by
Word = CreateOleObject("Word.Application");

Krgrds,
Perry

Hello,
I am working with OLE server using C++ Builder 6.0, the code is the following:

{
Variant Word, Document, Table, Cell;
int RowCount, ColCount;

Word = CreateOleObject("Word.Application.8");
Word.OlePropertySet("Visible", true);
Word.OlePropertyGet("Documents").OleProcedure("Add");
Document = Word.OlePropertyGet("Documents").OleFunction("Item", 1);
Table = Document.OlePropertyGet("Tables").OleFunction("Add", Document.OleFunction("Range", 0, 0), 5, 5);
RowCount = Table.OlePropertyGet("Rows").OlePropertyGet("Count");
ColCount = Table.OlePropertyGet("Columns").OlePropertyGet("Count");
for (int i=1; i <=RowCount; i++)
for(int j=1; j <=ColCount; j++) {
Cell = Table.OleFunction("Cell", i, j);
Cell.OlePropertyGet("Range").OleProcedure("InsertAfter", WideString(IntToStr(i)) + WideString("-") + WideString(IntToStr(j)));
}
Document.OleProcedure("SaveAs", ChangeFileExt(Application->ExeName, ".doc"));
Word.OleProcedure("Quit");
}


Under Windows XP Home Edition with Microsoft Word 2003 Standart Edition for Students and Teachers the Application gets an error
"Exception occured". Under Windows 2000 and Windows XP Pro with Microsoft Word 2003 everything is normal. What can be the reason?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Error with OLE server 0

Top