Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Syntax for Wordbasic.NextCell

Status
Not open for further replies.

mrbmike

Technical User
Aug 17, 2006
2
US
mrbmike (TechnicalUser) Aug 17, 2006
I am converting a macro that was created in 1996 to current VBA.

Does any one know the VBA Syntax for this wordbasic statement?

WordBasic.NextCell

I have tried using this statement.

Selection.Move Unit:=wdCell, Count:=1

It works if the cell has already been created. When the Nextcell statement is used it performs the same function as the TAB key, which is great. It creates the cell and moves the cursor to that cell.There is a table where each row has 2 columns and the first row is updated numerically. I need the code to create the next cell in the next row and update it then create the 2nd cell in the row where the user will then type in there text.

Here is a copy of the 1996 code.

WordBasic.NextCell
WordBasic.InsertField Field:="SEQ stpxseq \n \* MERGEFORMAT"
WordBasic.NextCell

Here is where I am at now.

WordBasic.NextCell

Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="SEQ stpxseq \n", _
PreserveFormatting:=True


WordBasic.NextCell

Any suggestions would be greatly appreciated,

Thanks
 
performs the same function as the TAB key
You may consider the (not so reliable) SendKeys function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

You can continue to use WordBasic.NextCell. AFAIK there is no VBA equivalent.

You would, however, be better working directly with your document data rather than via artificial cursor movement.

Do you always need to add a row to the table? If so, add it explicitly. If not, check first and then add it explcitly if need be. Having done that you can then add your field to the cell and then do whatever comes next - setting the selection for the user if that's what it is.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top