Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
|
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 9th, 2006, 07:13 AM
Authorized User
 
Join Date: Sep 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy only numeric value from one colum

Hi is it possible to copy only the numeric value from one colum to another colum in the same table?

Example:

Sub ABILIFY10()
    Selection.Font.Bold = True
    Selection.TypeText Text:="(ABILIFY 10 MG - CXS. 28 COMP.)"
    Selection.TypeParagraph
    Selection.TypeText Text:="Preço/comp.: "
    Selection.Font.Bold = False
    Selection.TypeText Text:=" CINCO VIRGULA ZERO TRÊS UM SETE OITO SEIS EUROS + IVA…………………………………."
    Selection.Font.Size = 6
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.Font.Size = 12
    Selection.Font.Bold = False
    Selection.TypeText Text:="N.º Reg. INFARMED: 5056387"
    Selection.TypeParagraph
End Sub

I want to copy Selection.TypeText Text:="N.º Reg. INFARMED: 5056387"
only the numeric value of this cell (5056387) to another cell in the same table.

 
Old November 22nd, 2006, 10:56 AM
Authorized User
 
Join Date: Nov 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can use the instr() function todo this
the parameters for the function are (starting position, string value, # characters)
you can also use
left(string value, # characters)
mid(string value, start point, # characters)
right(string value, # characters)

in this case you would use

strNewString = right(strInputString, 7)

you may need to use the dollar sign character:

strNewString = right$(strInputString, 7)

then use an append query to insert the value using the return value

if the length of the number is not constant, this makes things more complicated, let me know if this answers your question, ill have more time later to provide a more detailed answer

cheers
scott





Similar Threads
Thread Thread Starter Forum Replies Last Post
From numeric to alfa numeric ebekir XSLT 1 August 10th, 2007 06:13 AM
Multi Colum Listbox JAdkins Classic ASP Basics 3 July 9th, 2007 01:40 AM
table colum break mateenmohd Classic ASP Basics 0 May 25th, 2007 10:10 AM
Copy only numeric value from one colum hugoscp Excel VBA 2 October 16th, 2006 08:31 PM
Loading a dropdown from a datagrid colum brenclarke VB.NET 2002/2003 Basics 1 May 30th, 2004 08:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.