G
Gonzo
Error stating that I am trying to paste too much into a bookmark.
Basically an array is created from a list and some user inputs and the
contents of the array are used to populate bookmarks in a new template
(bookmarks inserted after loading the template and then text is
pasted).Works flawlessly for a short sentence but gives the error if it is
longer.What is interesting is that if the error dialog is closed the paste
operation obviously worked and the text is intact! Is there a limit to the
size a bookmark can take?
open the template:
add the bookmarks:
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="MED" & intC
Selection.MoveDown unit:=wdLine, Count:=1
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="AMT" & intC
Selection.MoveDown unit:=wdLine, Count:=10
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="REF" & intC
Move to the bookmark and add the appropriate text from the array:
Selection.GoTo what:=wdGoToBookmark, Name:="MED" & i
Selection.TypeText astrMed(i, 0)
Selection.GoTo what:=wdGoToBookmark, Name:="AMT" & i
Selection.TypeText astrMed(i, 1)
Selection.GoTo what:=wdGoToBookmark, Name:="REF" & i
Selection.TypeText astrMed(i, 2)
Print the prescription and close the template.
Seems to choke if the text added wraps to the next line
Thanks for any enlightenment.
Basically an array is created from a list and some user inputs and the
contents of the array are used to populate bookmarks in a new template
(bookmarks inserted after loading the template and then text is
pasted).Works flawlessly for a short sentence but gives the error if it is
longer.What is interesting is that if the error dialog is closed the paste
operation obviously worked and the text is intact! Is there a limit to the
size a bookmark can take?
open the template:
add the bookmarks:
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="MED" & intC
Selection.MoveDown unit:=wdLine, Count:=1
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="AMT" & intC
Selection.MoveDown unit:=wdLine, Count:=10
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="REF" & intC
Move to the bookmark and add the appropriate text from the array:
Selection.GoTo what:=wdGoToBookmark, Name:="MED" & i
Selection.TypeText astrMed(i, 0)
Selection.GoTo what:=wdGoToBookmark, Name:="AMT" & i
Selection.TypeText astrMed(i, 1)
Selection.GoTo what:=wdGoToBookmark, Name:="REF" & i
Selection.TypeText astrMed(i, 2)
Print the prescription and close the template.
Seems to choke if the text added wraps to the next line
Thanks for any enlightenment.