Code Comments
Programming Forum and web based access to our favorite programming groups.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?
Post Follow-up to this messageWhat 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? > >
Post Follow-up to this messageI 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 > >
Post Follow-up to this messageUse 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 > >
Post Follow-up to this messageSure - 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 > >
Post Follow-up to this messageThis 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 > >
Post Follow-up to this messageOK - 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 > >
Post Follow-up to this messageI 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 > >
Post Follow-up to this messageAaron, 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... >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.