Results 1 to 5 of 5

Thread: Field/Vba question :S easy i think?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,476
    Location
    Hi Froz,
    Welcome to VBAX
    Give this a try. You might need to play around with it a little but the principle is there.
    [vba]Private Sub Document_New()
    Dim Diff As Long, dt1 As Date, dt2 As Date, dt As String
    Diff = 7 - Weekday(Now)
    dt1 = Now + Diff - 5
    dt2 = Now + Diff - 1
    dt = "Week of " & Format(dt1, "dddd MMM d") & " - " & Format(dt2, "dddd MMM d")
    ActiveDocument.Bookmarks("Test").Range = dt
    End Sub

    [/vba]
    Last edited by mdmackillop; 02-27-2007 at 12:33 PM. Reason: dt1 corrected
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •