Run-time error '4248': this command is not available because no document is open
Hello my document is attached. I keep getting this error on Windows XP SP3
behavior is like this:
4248 referenced in title block above.
If I click “End” on the error window, the macros ran. They didn’t work right, though, because the boxes didn’t check.
If I choose Debug, then the Visual Basic page shows up and highlights the first half-line of the programing.
Any ideas? Thanks, Midani[vba]Private Sub Document_Open()
If ActiveDocument.FormFields("text64").Result = "Yes" Then ActiveDocument.FormFields("Check1").CheckBox.Value = True
If ActiveDocument.FormFields("text64").Result = "No" Then ActiveDocument.FormFields("Check2").CheckBox.Value = True[/vba][vba]
If ActiveDocument.FormFields("text65").Result = "Inpatient" Then ActiveDocument.FormFields("Check3").CheckBox.Value = True
If ActiveDocument.FormFields("text65").Result = "ER/Outpatient" Then ActiveDocument.FormFields("Check4").CheckBox.Value = True
If ActiveDocument.FormFields("text65").Result = "DOA" Then ActiveDocument.FormFields("Check5").CheckBox.Value = True
If ActiveDocument.FormFields("text65").Result = "Nursing Home" Then ActiveDocument.FormFields("Check6").CheckBox.Value = True
If ActiveDocument.FormFields("text65").Result = "Hospice" Then ActiveDocument.FormFields("Check7").CheckBox.Value = True
If ActiveDocument.FormFields("text65").Result = "Residence" Then ActiveDocument.FormFields("Check8").CheckBox.Value = True
If ActiveDocument.FormFields("text65").Result = "Other (Specify)" Then ActiveDocument.FormFields("Check9").CheckBox.Value = True
If ActiveDocument.FormFields("text66").Result = "Married" Then ActiveDocument.FormFields("Check10").CheckBox.Value = True
If ActiveDocument.FormFields("text66").Result = "Never Married" Then ActiveDocument.FormFields("Check11").CheckBox.Value = True
If ActiveDocument.FormFields("text66").Result = "Widowed" Then ActiveDocument.FormFields("Check12").CheckBox.Value = True
If ActiveDocument.FormFields("text66").Result = "Divorced" Then ActiveDocument.FormFields("Check13").CheckBox.Value = True
If ActiveDocument.FormFields("text66").Result = "Unknown" Then ActiveDocument.FormFields("Check14").CheckBox.Value = True
If ActiveDocument.FormFields("text67").Result = "Yes" Then ActiveDocument.FormFields("Check15").CheckBox.Value = True
If ActiveDocument.FormFields("text67").Result = "No" Then ActiveDocument.FormFields("Check16").CheckBox.Value = True
If ActiveDocument.FormFields("text68").Result = "No" Then ActiveDocument.FormFields("Check17").CheckBox.Value = True
If ActiveDocument.FormFields("text68").Result = "Yes" Then ActiveDocument.FormFields("Check18").CheckBox.Value = True
If ActiveDocument.FormFields("text69").Result = "Resomation" Then ActiveDocument.FormFields("Check19").CheckBox.Value = True
If ActiveDocument.FormFields("text69").Result = "Burial" Then ActiveDocument.FormFields("Check20").CheckBox.Value = True
If ActiveDocument.FormFields("text69").Result = "Cremation" Then ActiveDocument.FormFields("Check21").CheckBox.Value = True
If ActiveDocument.FormFields("text69").Result = "Removal from State" Then ActiveDocument.FormFields("Check22").CheckBox.Value = True
If ActiveDocument.FormFields("text69").Result = "Donation" Then ActiveDocument.FormFields("Check23").CheckBox.Value = True
If ActiveDocument.FormFields("text69").Result = "Other (Specify)" Then ActiveDocument.FormFields("Check24").CheckBox.Value = True
ActiveDocument.FormFields("text64").Result = " "
ActiveDocument.FormFields("text65").Result = " "
ActiveDocument.FormFields("text66").Result = " "
ActiveDocument.FormFields("text67").Result = " "
ActiveDocument.FormFields("text68").Result = " "
ActiveDocument.FormFields("text69").Result = " "
End Sub
Sub ChangeDocProperties()
On Error GoTo ErrHandler
ActiveDocument.BuiltInDocumentProperties("Title") = "DC (Burial)"
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
Sub CountHiddenDocs()
' This macro opens an existing document as hidden
' then makes the hidden document visible.
Dim Doc1 As Document
' Open MyDoc.Doc document as hidden.
Set Doc1 = Documents.Open("<Path>\MyDoc.Doc", Visible:=False)
' Reset the document object variable to make visible the
' hidden document.
'
' NOTE: The following command line will NOT open a
' second instance of the hidden document but instead
' make the currently open, hidden instance of the
' document visible.
Set Doc1 = Documents.Open("<Path>\MyDoc.Doc", Visible:=True)
Doc1.ActiveWindow.Activate
End Sub
[/vba]
1 Attachment(s)
Answer Regarding The Uses of this document
Hello I am so glad you commented, VBA is out of my realm and I need so much help on this one.
What happens is that there is a little table on the lower left hand side of the page, and what happens is that there are six (6) values that get passed to the document from a sister document in xml (words) and these words would execute checkboxes ordinarily. These are fields 64-69.
The word which passes as field 64 to the form informs the checkboxes to be checked.
EXAMPLE: If the person did military service under item 6 of the form, field name 64 could have two cases a yes or a no, and a yes would pass to the form and also check the box for yes or no. (It is this way with the rest, 65, 66, 67, 68 and 69. These cases pass to the form as an object in xml, a value that is retained in an dynamic web application.)
Honestly I could not see any examples of this on the internet, so it makes it particularly a difficult situation.
-----------------------------------------------------------------------------------------
I am also attaching a different version of the document.
Many Thanks, Midani