I am getting an “error 4605” This method is not available because the current selection partially covers a plain text content control.
The program is creating a form. The first part creates header, collects a name and create a file with that name.
The second part is creating a line with header and a selection box.
This part should be dumplicated few times.
The problem is that that I get the error message at the 2nd instance, sometimes at the 3rd or 4th.
I assume it relates to the layout of the page.
The first part code:
Sub CreatePFT() Documents.Add ‘ creating new blank document Dim zFileName As String zFileName = InputBox(“Enter patient name”, “User Entry Required”) If zFileName = “” Then MsgBox “File NOT saved you did not supply a filename!”, _ vbOKOnly + vbCritical, “Error: Filename missing!” Else ChangeFileOpenDirectory “C:UsersyigalDocumentsYigalGuy Livnattemp” ActiveDocument.SaveAs2 filename:=zFileName & “.docm”, FileFormat:= _ wdFormatXMLDocumentMacroEnabled Selection.HomeKey wdStory ‘ ActiveWindow.View.ReadingLayout = False With Selection .Font.ColorIndex = wdDarkBlue .Font.Bold = True .Font.Size = 28 .Font.Underline = True .ParagraphFormat.Alignment = wdAlignParagraphCenter .TypeText “PFT Interpretation” .TypeParagraph .Font.Size = 16 .TypeText “Dr. Guy Livnat” .TypeParagraph .TypeParagraph .Font.Bold = False .Font.Underline = False .ParagraphFormat.Alignment = wdAlignParagraphLeft .Font.ColorIndex = wdBlack .TypeText “The patient name is: ” .Font.Underline = True .Font.ColorIndex = wdDarkBlue .TypeText zFileName .TypeParagraph End With
The 2nd part, 2 instances:
‘ Vital Capacity With Selection ‘ .MoveDown Unit:=wdLine, Count:=7, Extend:=wdExtend .MoveDown wdLine, 1 .Font.ColorIndex = wdDarkBlue .Font.Size = 12 .Font.Bold = False .Font.Underline = False .TypeText Text:=”The Vital Capacity is:” & vbTab End With Dim objcc1 As ContentControl Set objcc1 = Selection.Range.ContentControls.Add(wdContentControlDropdownList) objcc1.DropdownListEntries.Add “Normal” objcc1.DropdownListEntries.Add “Low Normal” objcc1.DropdownListEntries.Add “Increased” objcc1.DropdownListEntries.Add “Decreased” With Selection .Font.Bold = False .Font.Underline = False .ParagraphFormat.Alignment = wdAlignParagraphLeft .Font.ColorIndex = wdDarkBlue .Font.Size = 12 .MoveDown Unit:=wdLine, Count:=5 .TypeParagraph .TypeParagraph .TypeParagraph .TypeParagraph End With ‘—————————————————————————————— ‘ Vital Capacity 1 With Selection ‘ .MoveDown Unit:=wdLine, Count:=7, Extend:=wdExtend .MoveDown wdLine, 1 .Font.ColorIndex = wdDarkBlue .Font.Size = 12 .Font.Bold = False .Font.Underline = False .TypeText Text:=”The Vital1 Capacity is:” & vbTab End With Dim objcc11 As ContentControl Set objcc11 = Selection.Range.ContentControls.Add(wdContentControlDropdownList) objcc11.DropdownListEntries.Add “Normal” objcc11.DropdownListEntries.Add “Low Normal” objcc11.DropdownListEntries.Add “Increased” objcc11.DropdownListEntries.Add “Decreased” With Selection .Font.Bold = False .Font.Underline = False .ParagraphFormat.Alignment = wdAlignParagraphLeft .Font.ColorIndex = wdDarkBlue .Font.Size = 12 .MoveDown Unit:=wdLine, Count:=1 [COLOR=”#FFD700″].TypeParagraph[/COLOR] End With
The error points to the last
.TypeParagraph
I marked with yellow.
Any idea how to solve the problem?