From: ker_01 on

I've been asked to extract data from an existing form that I didn't set up,
and the format is less than ideal. To minimize my cycles of testing, it would
be much easier to place my cursor in a sample document, and then debug.print
the cursor location as table coordinates so I can hardcode the 'cells' that I
need to extract. There are about 15 tables total, and I'll have to extract
content from most of them.

I played around with the range.parent object but couldn't figure out how to
return the table info.

I also googled, but no joy.

Any suggestions or snippets would be greatly appreciated.

Thanks,
Keith
From: ker_01 on
I kept searching and found a partial answer here:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=867
but that still doesn't get me the table number. Can anyone provide the
object model syntax to capture the table count as well?

Thank you!
Keith

"ker_01" wrote:

>
> I've been asked to extract data from an existing form that I didn't set up,
> and the format is less than ideal. To minimize my cycles of testing, it would
> be much easier to place my cursor in a sample document, and then debug.print
> the cursor location as table coordinates so I can hardcode the 'cells' that I
> need to extract. There are about 15 tables total, and I'll have to extract
> content from most of them.
>
> I played around with the range.parent object but couldn't figure out how to
> return the table info.
>
> I also googled, but no joy.
>
> Any suggestions or snippets would be greatly appreciated.
>
> Thanks,
> Keith
From: Greg Maxey on
I haven't used this in a while, but I think it might help you:

http://gregmaxey.mvps.org/Table_Cell_Data.htm

ker_01 wrote:
> I've been asked to extract data from an existing form that I didn't
> set up, and the format is less than ideal. To minimize my cycles of
> testing, it would be much easier to place my cursor in a sample
> document, and then debug.print the cursor location as table
> coordinates so I can hardcode the 'cells' that I need to extract.
> There are about 15 tables total, and I'll have to extract content
> from most of them.
>
> I played around with the range.parent object but couldn't figure out
> how to return the table info.
>
> I also googled, but no joy.
>
> Any suggestions or snippets would be greatly appreciated.
>
> Thanks,
> Keith


From: Greg Maxey on



Dim pTableNumber As String
pTableNumber = "The selection is in table: " & _
ActiveDocument.Range(0,
Selection.Tables(1).Range.End).Tables.Count
MsgBox pTableNumber & ". The selection covers " &
Selection.Cells.Count & " cells, from Cell(" & _




ker_01 wrote:
> I kept searching and found a partial answer here:
> http://www.vbaexpress.com/kb/getarticle.php?kb_id=867
> but that still doesn't get me the table number. Can anyone provide the
> object model syntax to capture the table count as well?
>
> Thank you!
> Keith
>
> "ker_01" wrote:
>
>>
>> I've been asked to extract data from an existing form that I didn't
>> set up, and the format is less than ideal. To minimize my cycles of
>> testing, it would be much easier to place my cursor in a sample
>> document, and then debug.print the cursor location as table
>> coordinates so I can hardcode the 'cells' that I need to extract.
>> There are about 15 tables total, and I'll have to extract content
>> from most of them.
>>
>> I played around with the range.parent object but couldn't figure out
>> how to return the table info.
>>
>> I also googled, but no joy.
>>
>> Any suggestions or snippets would be greatly appreciated.
>>
>> Thanks,
>> Keith