Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Word automation
I need to open a word document, read a multi column table and translate it
into a database table. Anyone knows where I can find sample vb code for the
Word automation part of this?



Report this thread to moderator Post Follow-up to this message
Old Post
Aaron Blacksmith
04-25-05 08:55 PM


Re: Word automation
What I would do is start with code like:
http://www.veign.com/vrc_codeview.asp?type=app&id=62

and then goto Word and use the Record Macro feature to get an idea of the
code required to do what you want.  Should be noted that the code generated
from the Record Macro may not be the cleanest code but it does point you in
the right direction..

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/


"Aaron Blacksmith" <Aaron@___Nospam.com> wrote in message
news:NU4be.135539$dP1.477803@newsc.telia.net...
> I need to open a word document, read a multi column table and translate it
> into a database table. Anyone knows where I can find sample vb code for
the
> Word automation part of this?
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Veign
04-25-05 08:55 PM


Re: Word automation
I don't have a problem with the basic automation - instead my problem is
that the document I want to read stores a table in a textbox. How can I
access the table and read the contents of it, cell by cell? (tables.count
returns zero).

"Veign" <NOSPAMinveign@veign.com> wrote in message
news:%23vu3vUaSFHA.3288@TK2MSFTNGP14.phx.gbl...
> What I would do is start with code like:
> http://www.veign.com/vrc_codeview.asp?type=app&id=62
>
> and then goto Word and use the Record Macro feature to get an idea of the
> code required to do what you want.  Should be noted that the code
> generated
> from the Record Macro may not be the cleanest code but it does point you
> in
> the right direction..
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
> http://www.veign.com/vrc_main.asp
> --
> Read. Decide. Sign the petition to Microsoft.
> http://classicvb.org/petition/
>
>
> "Aaron Blacksmith" <Aaron@___Nospam.com> wrote in message
> news:NU4be.135539$dP1.477803@newsc.telia.net... 
> the 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Aaron Blacksmith
04-26-05 01:56 PM


Re: Word automation
Use the Record Macro and change the contents of some of the cells and see
what code is produced to access the table cells.  This, again, should point
you in the right direction.

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/


"Aaron Blacksmith" <Aaron@___Nospam.com> wrote in message
news:Efnbe.22675$d5.167004@newsb.telia.net...
> I don't have a problem with the basic automation - instead my problem is
> that the document I want to read stores a table in a textbox. How can I
> access the table and read the contents of it, cell by cell? (tables.count
> returns zero).
>
> "Veign" <NOSPAMinveign@veign.com> wrote in message
> news:%23vu3vUaSFHA.3288@TK2MSFTNGP14.phx.gbl... 
the 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Veign
04-26-05 08:56 PM


Re: Word automation
Sure - that't the default method for me as well. In this case, however, the
macro recorder seems to block the access to the textbox, so I can't make it
record how to access it. I have also tried a search for a word inside the
textbox, which works fine outside a macro, but not at all inside a macro
with the search recorded. So - unfortunately - it's status quo...

(I run office 2003 + XP.)
Aaron




"Veign" <NOSPAMinveign@veign.com> wrote in message
news:OdSAu1mSFHA.2000@TK2MSFTNGP10.phx.gbl...
> Use the Record Macro and change the contents of some of the cells and see
> what code is produced to access the table cells.  This, again, should
> point
> you in the right direction.
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
> http://www.veign.com/vrc_main.asp
> --
> Read. Decide. Sign the petition to Microsoft.
> http://classicvb.org/petition/
>
>
> "Aaron Blacksmith" <Aaron@___Nospam.com> wrote in message
> news:Efnbe.22675$d5.167004@newsb.telia.net... 
> the 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Aaron Blacksmith
04-27-05 01:56 PM


Re: Word automation
This code shows accessing table cells:
http://www.word.mvps.org/faqs/macro...leCellEmpty.htm

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/


"Aaron Blacksmith" <Aaron@___Nospam.com> wrote in message
news:o%Jbe.22727$d5.167347@newsb.telia.net...
> Sure - that't the default method for me as well. In this case, however,
the
> macro recorder seems to block the access to the textbox, so I can't make
it
> record how to access it. I have also tried a search for a word inside the
> textbox, which works fine outside a macro, but not at all inside a macro
> with the search recorded. So - unfortunately - it's status quo...
>
> (I run office 2003 + XP.)
> Aaron
>
>
>
>
> "Veign" <NOSPAMinveign@veign.com> wrote in message
> news:OdSAu1mSFHA.2000@TK2MSFTNGP10.phx.gbl... 
see 
is 
(tables.count 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Veign
04-27-05 08:55 PM


Re: Word automation
OK - thanks - but accessing table cells is not the problem. The problem is
when the table is located inside a text box. The text box seems to hide the
table - at least I haven't found the way to get through it. Sorry for
describing the problem badly...
Aaron



"Veign" <NOSPAMinveign@veign.com> wrote in message
news:%23HCO5qzSFHA.3544@TK2MSFTNGP12.phx.gbl...
> This code shows accessing table cells:
> http://www.word.mvps.org/faqs/macro...leCellEmpty.htm
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
> http://www.veign.com/vrc_main.asp
> --
> Read. Decide. Sign the petition to Microsoft.
> http://classicvb.org/petition/
>
>
> "Aaron Blacksmith" <Aaron@___Nospam.com> wrote in message
> news:o%Jbe.22727$d5.167347@newsb.telia.net... 
> the 
> it 
> see 
> is 
> (tables.count 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Aaron Blacksmith
04-27-05 08:55 PM


Re: Word automation
I guess I don't know enough about tables in Word to properly answer your
question.  I can't seem to visualize a table inside of a textbox.  Your best
course of action would be to post this question in the Word programming /
VBA newsgroup as those guys would have a better understanding of the Word
API..

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/


"Aaron Blacksmith" <Aaron@___Nospam.com> wrote in message
news:FbPbe.22744$d5.167423@newsb.telia.net...
> OK - thanks - but accessing table cells is not the problem. The problem is
> when the table is located inside a text box. The text box seems to hide
the
> table - at least I haven't found the way to get through it. Sorry for
> describing the problem badly...
> Aaron
>
>
>
> "Veign" <NOSPAMinveign@veign.com> wrote in message
> news:%23HCO5qzSFHA.3544@TK2MSFTNGP12.phx.gbl... 
make 
the 
macro 
problem 
can 
point 
code 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Veign
04-27-05 08:55 PM


Re: Word automation
Aaron,
The only thing I can see is:
'Select the desired text box
ActiveDocument.Shapes(1).Select
'Manipulate the table data
Selection.Tables.Count

There seems no way to access the .Table from .Shape without going through th
e Selection object.

NickHK

On Wed, 27 Apr 2005 16:35:49 GMT, "Aaron Blacksmith" <Aaron@___Nospam.com> w
rote:

>OK - thanks - but accessing table cells is not the problem. The problem is
>when the table is located inside a text box. The text box seems to hide the
>table - at least I haven't found the way to get through it. Sorry for
>describing the problem badly...
>Aaron
>
>
>
>"Veign" <NOSPAMinveign@veign.com> wrote in message
>news:%23HCO5qzSFHA.3544@TK2MSFTNGP12.phx.gbl... 
>


Report this thread to moderator Post Follow-up to this message
Old Post
NickHK
04-28-05 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:31 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.