Hi Guys,
I have a template which is there in Templates folder of C:\Program files(x86)\Microsoft Office\Templates\London folder.
Now when I click the icon from word ribbon which i have created to initialize the signature template from the London folder, it should pop up Signature user form with word document in background so the user can enter their details.
But, I receive a run time error '4248', this command is not available because no document is open.
i found few articles where they have written code to trap the error and then initialize the template.below is one of the code form the source link WD2000: Error Message: "Run-time error '4248'; 'This command is not available because no document is open.'"
One more code is updated for the same
Now, I would like to clarify where to place this code in word document ?
Is it in ThisDocument of the Word document or in Modules of template macro code ?
Also please confirm whether the above code will initialize the template user form after the error is trapped and cleared ?
I have a template which is there in Templates folder of C:\Program files(x86)\Microsoft Office\Templates\London folder.
Now when I click the icon from word ribbon which i have created to initialize the signature template from the London folder, it should pop up Signature user form with word document in background so the user can enter their details.
But, I receive a run time error '4248', this command is not available because no document is open.
i found few articles where they have written code to trap the error and then initialize the template.below is one of the code form the source link WD2000: Error Message: "Run-time error '4248'; 'This command is not available because no document is open.'"
Code:
Sub ChangeDocProperties()
On Error GoTo ErrHandler
ActiveDocument.BuiltInDocumentProperties("Title") = "My Title"
Exit Sub
ErrHandler:
If Err <> 0 Then
'Add a document.
Documents.Add
'Clear the error.
Err.Clear
'Execute the code that caused the error.
Resume
End If
End Sub
One more code is updated for the same
Code:
F
Function IsWordDocOpen(sWordDocFullName As String) as Boolean
Dim wdApp as Object ' Late Binding - who cares?
Dim wdDoc as Object
IsWordDocOpen = False
On Error Resume Next
'- try to get Word application
Set wdApp = GetObject(, "Word.Application")
If Err.Number = 4248 Then ' Word is not open
Exit Function
End If
On Error GoTo 0
For Each wdDoc in wdApp.Documents
If wddoc.FullName = sWordDocFullName Then
IsWordDocOpen = True
Exit Function
End If
Next
End Function
Now, I would like to clarify where to place this code in word document ?
Is it in ThisDocument of the Word document or in Modules of template macro code ?
Also please confirm whether the above code will initialize the template user form after the error is trapped and cleared ?