1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Office Pro 2003, Excel question

Discussion in 'Other PC Software' started by OLDSALTY, 2006/05/23.

  1. 2006/05/23
    OLDSALTY Lifetime Subscription

    OLDSALTY Inactive Thread Starter

    Joined:
    2003/02/21
    Messages:
    573
    Likes Received:
    0
    I create a document each week with a template form I created. I want to automatically have the date inserted into a field when I create the weekly form, but and here is the kicker, I only want the date that the form was created on. What happens now if I open the form at a later date the current date changes the original date. So I am trying to figure out how after the original is created the formula in the field can be changed to show just the original date.
     
  2. 2006/05/24
    Steve R Jones

    Steve R Jones SuperGeek Staff

    Joined:
    2001/12/30
    Messages:
    12,317
    Likes Received:
    252
    Instead of a forumla, type it in as text/lable-> '05/24/06
     

  3. to hide this advert.

  4. 2006/05/24
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    You could use a macro in a control workbook.
    Code:
    Sub CreateNewWorkbook()
        Dim NewWorkbook As Workbook
        Set NewWorkbook = Workbooks.Add( "Template.xls ")
        NewWorkbook.Sheets(1).Cells(3, 2).Value = Date
    End Sub
    
    This puts the current date in Sheet 1, row 3, column 2. As the script is run at workbook creation, that date is the creation date.

    This is some help from the Office 2000 Excel VBA help that explains using Workbooks.Add with a template option:
     
  5. 2006/05/24
    OLDSALTY Lifetime Subscription

    OLDSALTY Inactive Thread Starter

    Joined:
    2003/02/21
    Messages:
    573
    Likes Received:
    0
    My template is "expense.xlt ". I usually submit my expenses each Monday. When I open the expense.xlt I would type in the date and my name at the top of the form in the proper fields. What I did was to enter "today()" in the field for the date and my name in the field for it and saved the template. Now when I open it I get what I want until I open the "xls" file that was created. When I open the xls file the date changes to the current date, I do not want that to happen. I read the code ReggieB provided, where would I put that in my template "expense.xlt "?
     
  6. 2006/05/24
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    Have a look at this tutorial. Code input is shown in step 3.
     
  7. 2006/05/24
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    Oh! and change the line
    Code:
    Set NewWorkbook = Workbooks.Add( "Template.xls ")
    
    to
    Code:
    Set NewWorkbook = Workbooks.Add( "expense.xlt ")
    
     
  8. 2006/05/25
    OLDSALTY Lifetime Subscription

    OLDSALTY Inactive Thread Starter

    Joined:
    2003/02/21
    Messages:
    573
    Likes Received:
    0
    OK, I guess I am missing something. I can create a module and procedures, but how do I get the template to execute the procedure when I load "expense.xlt ". When I load "expense.xlt" much of the form is protected and cannot be changed. After I add my expenses for the week and save the form, I am prompted for a "name ".xls, I do not write over the xlt that I created. If I must edit the xlt I can also do that. So now what kicks off the procedure in the xlt to populate the field with the date (today())? I went through the tutorials for awhile but they did not answer this question.
     
  9. 2006/05/25
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    With the method I am suggesting, you don't load "expense.xlt" directly. You create a control sheet (call it "control.exe "). You open that, fire off the macro, and that loads a new spreadsheet based on "expense.xlt" with the date entered.
     
  10. 2006/05/25
    OLDSALTY Lifetime Subscription

    OLDSALTY Inactive Thread Starter

    Joined:
    2003/02/21
    Messages:
    573
    Likes Received:
    0
    Now I am really lost. This is getting complicated.
     
  11. 2006/05/26
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    Yes. I think I have overcomplicated things by giving you another option. Perhaps the best answer is Steve R Jones' original one. Make the entry a manual entry rather than using the current date function. :(
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.