Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 09-05-2017, 02:11 AM
slaycock slaycock is offline Pizza Tips - Simple Addition In Word Document Windows 7 64bit Pizza Tips - Simple Addition In Word Document Office 2013
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

Or if you really wanted to play around with ranges, but much less readable/understandable than above

Code:
Sub UpdateMyTips()

Dim myNewTip As Long
Dim myOldTotal As Long
    
   With ActiveDocument.Paragraphs(2).Range.Words(1)
        With .Previous(unit:=wdParagraph).Words(1)
            myNewTip = CLng(.Text)
            .Text = " " & vbCrLf
        End With
        myOldTotal = CLng(.Words(1).Text)
        .Words(1).Text = CStr(myNewTip + myOldTotal) & " "
        .Paragraphs(1).Range.InsertAfter Text:=myNewTip & " " & Format(Now(), "DDDD, MMMM d, yyyy") & vbCrLf
    End With
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pizza Tips - Simple Addition In Word Document Addition James__S Word 1 08-18-2016 06:20 PM
Pizza Tips - Simple Addition In Word Document Addition of new colors marif300 Project 3 05-20-2016 07:32 AM
Pizza Tips - Simple Addition In Word Document Addition Formula is Giving a Date!!! MikeM3 Excel 9 01-15-2016 02:41 AM
Pizza Tips - Simple Addition In Word Document Need tips for creating a specific word format DomDom Word 5 09-24-2014 01:24 AM
Pizza Tips - Simple Addition In Word Document Putting a horizontal line in a Word Document -- should be simple, right? biotechguy Word 4 05-10-2010 11:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:57 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft