View Single Post
 
Old 08-18-2014, 07:33 PM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Ok, I see what you are talking about. But, I really don't know what your end goal is.

AutoNew fires before document_new. You can see that your self by putting different message boxes in each.

Try this:

Code:
Sub AutoNew()
Dim lngNewRandNumber
Dim oDoc As Document
  MsgBox "AN"
  Randomize
  lngNewRandNumber = Int((1000 * Rnd) + 1)
  MsgBox ThisDocument.CustomDocumentProperties("RandomNumber").Value
  ThisDocument.CustomDocumentProperties("RandomNumber").Value = lngNewRandNumber
  Set oDoc = ActiveDocument.AttachedTemplate.OpenAsDocument
  oDoc.CustomDocumentProperties("RandomNumber").Value = lngNewRandNumber
  oDoc.Close wdSaveChanges
  ActiveDocument.CustomDocumentProperties("RandomNumber").Value = lngNewRandNumber
  MsgBox ThisDocument.CustomDocumentProperties("RandomNumber").Value
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote