Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Populating an MSWord document table from BCB

Posted on 2001-07-27
5
Medium Priority
?
536 Views
Last Modified: 2011-04-14
I want to populate a table in a Word document from a BCB program.  The VBA fragment:

Dim MSWord As New Word.Application
Dim Doc As Word.Document

    Set Doc = MSWord.Documents.Add(Template:="C:\mytemp.dot",NewTemplate:False)
    Doc.Tables(1).Rows.Last.Cells(1).Range.Text = "some"
    etc..

...works fine as a Word macro, but I cannot get:

   MSWord = MSWord.CreateObject("Word.Application");
   Variant NewDoc = MSWord.OlePropertyGet("Documents").OleFunction("Add", "C:\\mytemp.dot",False);
   Variant Doc = MSWord.OlePropertyGet("ActiveDocument");
   Variant Tables = Doc.OlePropertyGet("Tables");
   Variant Table = Tables.OleFunction("Item" , 1);
   Variant Rows =  Table.OlePropertyGet("Rows");
   Variant Last =  Rows.OlePropertyGet("Last");
   Variant Cells = Last.OlePropertyGet("Cells");
   Variant Cell  = Cells.OleFunction("Item", 1);
   Variant Range = Cell.OlePropertyGet("Range");
   Range.OlePropertySet("Text", "some");

... to work at all.  The program halts at the "Variant Rows" line with an _ASSERTE dialog box and an "IsBound()" error.

Does anyone know an easy way to do this or where my error is?
0
Comment
Question by:TonyNJones
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 4

Expert Comment

by:AssafLavie
ID: 6326651
This is a C++ forum.
0
 

Author Comment

by:TonyNJones
ID: 6368309
This is a problem from C++ Builder;  where should I post this problem?
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6375448
My be use other metod:
...
TablePtr wordTable = WordApplication->ActiveDocuments-Tables->Item(1);
long m_Row = 1;
long m_Column = 2;
CellPtr wordCell = wordTable->Cell(m_Row,m_Column);
...
0
 
LVL 11

Expert Comment

by:griessh
ID: 6840249
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to refund the points and PAQ at zero points since nobody had an answer for you.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner

0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 6857835
After review, the proposed answer will be accepted by:

ComTech
Community Support
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question