Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2010, 10:15 PM
Ziggy-R Ziggy-R is offline Calculated dates. Windows XP Calculated dates. Office 2003
Novice
Calculated dates.
 
Join Date: Sep 2010
Posts: 13
Ziggy-R is on a distinguished road
Cool Calculated dates.

Afternoon, guys.



So, I'm trying to figure out calculated dates, using either fields or macros, doesn't bother me. I've got an autodate for when you use the document, and a macro to calculate the date 7 days from today, which automatically runs upon opening the document. The only problem with that though, is that it inserts the date at the very beginning of the document, which isn't where I want it.

So, my question is, can some either
a) walk me through fields, as I've never used them in my life, or
b) tell me how to alter the macro to insert the date at the section of the document I need it at?

Any help would be greatly appreciated.
Reply With Quote
  #2  
Old 09-25-2010, 10:29 AM
Kimberly Kimberly is offline Calculated dates. Windows 7 Calculated dates. Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

What happens when the file is opened a second time?
Reply With Quote
  #3  
Old 09-27-2010, 05:17 PM
Ziggy-R Ziggy-R is offline Calculated dates. Windows XP Calculated dates. Office 2003
Novice
Calculated dates.
 
Join Date: Sep 2010
Posts: 13
Ziggy-R is on a distinguished road
Default

When I open it a second time? The same thing again. The macro runs, promts me to enter how many days from today I wish to show (7), I press "OK", it inserts it at the very start of the document.
Reply With Quote
  #4  
Old 09-27-2010, 05:35 PM
Kimberly Kimberly is offline Calculated dates. Windows 7 Calculated dates. Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

So it's going to keep inserting dates... if the file has been opened 22 times, there will be 22 dates inserted? .

"promts me to enter how many days from today I wish to show"... Prompts you? How many days to show? In your original post, you wanted to calculate and insert a date 7 days in the future. Now it seems you want to be prompted for the number of days and use that date to control the display of something.

What exactly are you trying to do?
Reply With Quote
  #5  
Old 09-27-2010, 05:40 PM
Ziggy-R Ziggy-R is offline Calculated dates. Windows XP Calculated dates. Office 2003
Novice
Calculated dates.
 
Join Date: Sep 2010
Posts: 13
Ziggy-R is on a distinguished road
Default

Quote:
Originally Posted by Kimberly View Post
So it's going to keep inserting dates... if the file has been opened 22 times, there will be 22 dates inserted? .

"promts me to enter how many days from today I wish to show"... Prompts you? How many days to show? In your original post, you wanted to calculate and insert a date 7 days in the future. Now it seems you want to be prompted for the number of days and use that date to control the display of something.

What exactly are you trying to do?

The idea is to not save the file once you're finished using it, keeping it as a template. This means there would only be two dates in the document; todays date, and the future date. The content is all inserted through a mail merge, and the dates are autoupdating. I have a macro in place that prompts me when I open the file, asking me how many days from today I wish to insert. I enter 7, and it automatically inserts the date 7 days from today, but at the start of the document. I want to enter it at a certain point about halfway through the document, but I don't know how to set the macro to enter it here. That's what I'm trying to do.
Reply With Quote
  #6  
Old 09-27-2010, 06:00 PM
Kimberly Kimberly is offline Calculated dates. Windows 7 Calculated dates. Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

Make sure the insertion point is at the start of the document.
Turn on the macro recorder.
Use the keyboard to navigate to the spot where you want the date.
Stop recording
Copy that code and paste it into the code you already have.
Reply With Quote
  #7  
Old 09-27-2010, 06:20 PM
Ziggy-R Ziggy-R is offline Calculated dates. Windows XP Calculated dates. Office 2003
Novice
Calculated dates.
 
Join Date: Sep 2010
Posts: 13
Ziggy-R is on a distinguished road
Default

Okay Kim, just tried that to no effect. Copied and pasted the code as follows:

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 28 September 2010 by Trainee
'
Selection.MoveDown Unit:=wdLine, Count:=24
Selection.MoveRight Unit:=wdCharacter, Count:=37
End Sub

And pasted that at the start of my existing code. It had no effect whatsoever, the document still opened at the very beginning, and that's where the date is inserted as well.
Reply With Quote
  #8  
Old 09-27-2010, 06:37 PM
Kimberly Kimberly is offline Calculated dates. Windows 7 Calculated dates. Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

To clarify, you just pasted this part, right?:
Selection.MoveDown Unit:=wdLine, Count:=24
Selection.MoveRight Unit:=wdCharacter, Count:=37
Reply With Quote
  #9  
Old 09-27-2010, 06:43 PM
Ziggy-R Ziggy-R is offline Calculated dates. Windows XP Calculated dates. Office 2003
Novice
Calculated dates.
 
Join Date: Sep 2010
Posts: 13
Ziggy-R is on a distinguished road
Default

Naw, I had it all pasted in (first time ever using macros). I've just pasted that section in and it's working how I want it to now; cheers, Kimberly.
Reply With Quote
  #10  
Old 09-27-2010, 08:09 PM
Kimberly Kimberly is offline Calculated dates. Windows 7 Calculated dates. Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

Yay! You did a great job. Can you mark the thread solved?
Reply With Quote
  #11  
Old 09-28-2010, 01:42 AM
Ziggy-R Ziggy-R is offline Calculated dates. Windows XP Calculated dates. Office 2003
Novice
Calculated dates.
 
Join Date: Sep 2010
Posts: 13
Ziggy-R is on a distinguished road
Default

Woah, sorry, just found a new problem.

So, that worked wonderfully thanks to Kim, but now I'm presented with another problem. The document seems to run the mail merge before the macro, which adds a whole mess of spaces, leaving the macro's starting point to enter the date completely incorrect. Any way to make the macro run before anything else?
Reply With Quote
Reply

Tags
calculated dates, fields, macros

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the difference of two dates based on criterion. aligahk06 Excel 0 04-27-2010 12:12 AM
Calculated dates. Searching dates to create lists brianh Excel 2 01-18-2010 01:58 PM
Calculated dates. MS Excel 2004 for Mac - copying dates between documents BCRenton Excel 4 11-10-2009 07:28 AM
Using calculated field - WHY IS IT SO COMPLICATED? Riorin Word 0 10-30-2009 12:20 PM
Adding dates mkkram Word 0 11-27-2006 09:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:18 PM.


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