-
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.
-
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
-
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?
-
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
-
Forum Rules