Consulting

Results 1 to 4 of 4

Thread: update or overwrite template in startup

  1. #1
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location

    update or overwrite template in startup

    How can I update or overwrite template in startup folder using VBA

    [vba]startdir = Application.Options.DefaultFilePath(wdStartupPath)[/vba]

    It is not a problem to copy template with a click on a button but the problem is if I want to overwrite existing template in STARTUP folder beacuse word is using it.

    Any ideas how can I avoid this usage of certain template in startup? Is it possible to somehow write to the code that it should not use startup folder at time of overwriting

    Thnx

    And how can I use path with variable: i.e.
    "\\DG7BLUXSNCF02\Users\name\Application Data\Microsoft\Word\STARTUP\Stetjebold.dot" _
    ).Installed = False
    name = application.username
    Any ideas
    Last edited by saban; 10-11-2006 at 06:14 AM.

  2. #2
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location

    Guys i have found the solution

    [VBA]Private Sub CommandButton1_Click()
    On Error GoTo Fail
    Dim startdir As String
    startdir = Application.Options.DefaultFilePath(wdStartupPath)
    If startdir = "" Then GoTo Fail
    If Dir(startdir & "\" & "Stetjebold.dot") = "" Then
    ActiveDocument.SaveAs FileName:=startdir & "\" & "Stetjebold.dot"
    MsgBox "Datoteka je bila skopirana v tvoj Startup." & vbCrLf & "Ponovno za?eni word da bodo spremembe vidne Hvala"
    Else
    If Dir(startdir & "\" & "Stetjebold.dot") = Dir(startdir & "\" & "Stetjebold.dot") Then
    KillFile = Dir(startdir & "\" & "Stetjebold.dot")
    Dim ime As String
    ime = Application.UserName
    Dim scenca
    AddIns( _
    startdir & "\" & "Stetjebold.dot").Installed = False

    End If
    ActiveDocument.SaveAs FileName:=startdir & "\" & "Stetjebold.dot"
    MsgBox "Datoteka je bila posodobljena." & vbCrLf & "Ponovno za?eni word da bodo spremembe vidne Hvala"
    AddIns( _
    startdir & "\" & "Stetjebold.dot").Installed = True
    End If
    End
    Fail:
    MsgBox "Ni mo?o shraniti v startup folder " & vbCrLf & "Poglej ali ima? nastavljeno pot za startup" & vbCrLf & "Tools/Options/filelocations"
    End Sub
    [/VBA]

    just disable add-ins and that is it

  3. #3
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Good for you. Thank you for following up and posting that you figured it out.

    Did you also get the answer to the user name variable?

  4. #4
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    no that one I didnt find(user name variable)

    Stay cool and Thnx for everything

Posting Permissions

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