Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jun 2002
    Location
    Johannesburg, Gauteng, South Africa
    Posts
    59
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Run Code when creating a new workbook (2000 SR-1)

    Please can someone help. I have created a template and wish to have some code run only when a new workbook based on that template is created. The code must not run when the workbook is subsequently opened. I realise I am probably being "dof" (Good old South Africanese for stupid) and should easily be able to do this but would appreciate any help I can get. <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run Code when creating a new workbook (2000 SR-1)

    For a new workbook, the Path property is "" (empty string).
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Star Lounger
    Join Date
    Jun 2002
    Location
    Johannesburg, Gauteng, South Africa
    Posts
    59
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Run Code when creating a new workbook (2000 SR-1)

    Thanks Jan Karel, I used the following:

    If Application.ActiveWorkbook.Path = "" Then ....
    End If

    and it works just fine.

Posting Permissions

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