Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Cell address (Word XP, SR1)

    Is it possible, using VBA to determine the "address" of a cell? If my insertion point is in a particular cell of a table, can I use VBA to retrieve the row/column? Say I'm in the first cell of a table. I would want VBA to return A1 as the address. Is there a mean by which I can access that information?

    Thanks, Richard Barrett

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Cell address (Word XP, SR1)

    Have a look at the parameters to selection.information, specifically wdWithinTable, wdEndOfRangeRowNumber and wdEndOfRangeColumnNumber

    StuartR

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: Cell address (Word XP, SR1)

    Thanks so much. I was looking under Row and Column, and of course I didn't see anything useful.

    Thanks again.

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cell address (Word XP, SR1)

    I would like to add a word of warning, that may apply to XP, it may not. I have had the following happen to me on both W97 and W2K

    If you have merged cells, you may get "weird" results.

    I had a table and I needed to get the cell number. On Some PCs the Column would return the first column of the merged cell and on other PCs it would return the last column number of the merged cell. Have a look at the table below.


    <table border=1><td>row1-col1</td><td>row1-col2</td><td>row1-col2</td><td colspan=3>return - row 2 - col 1 on some PCs</td><td colspan=3>return - row 3 - col 3 on other PCs</td></table>

    I never did find out the reason, I just worked around the problem.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: Cell address (Word XP, SR1)

    Thanks. This is exactly the issue I was trying to avoid. Merged cells really do throw off the row/column position, and I'm using a couple cormulas where the correct cell address is (obviously) critical. I'll keep your advice in mind.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •