S
sweet_dreams
Hi all,
I have such a problem: I wrote sub to copy text form one doc to
currently open document. I attached this sub to button I would like it
to insert text form another doc in the selection in document which I
edit. But instead of inserting text to currently open doc it copies
text to the file from which this sub takes text:
Dim OpisKryterium As New Document
Set OpisKryterium =
Application.Documents.Open(SciezkaKryterium(NrKryt))
Dim TekstOpisu As Range
Dim DlugoscTekstu As Long
DlugoscTekstu = OpisKryterium.Characters.Count
Set TekstOpisu = OpisKryterium.Range(0, DlugoscTekstu - 1)
Selection.FormattedText = TekstOpisu.FormattedText
OpisKryterium.Close
Set OpisKryterium = Nothing
Set TekstOpisu = Nothing
I think that it is because of this line:
Selection.FormattedText = TekstOpisu.FormattedText
but I tried to do it with ActiveDocument but result is the same. So how
can I reference to currently open doc.
Please help.
Regards,
sweet_dreams
I have such a problem: I wrote sub to copy text form one doc to
currently open document. I attached this sub to button I would like it
to insert text form another doc in the selection in document which I
edit. But instead of inserting text to currently open doc it copies
text to the file from which this sub takes text:
Dim OpisKryterium As New Document
Set OpisKryterium =
Application.Documents.Open(SciezkaKryterium(NrKryt))
Dim TekstOpisu As Range
Dim DlugoscTekstu As Long
DlugoscTekstu = OpisKryterium.Characters.Count
Set TekstOpisu = OpisKryterium.Range(0, DlugoscTekstu - 1)
Selection.FormattedText = TekstOpisu.FormattedText
OpisKryterium.Close
Set OpisKryterium = Nothing
Set TekstOpisu = Nothing
I think that it is because of this line:
Selection.FormattedText = TekstOpisu.FormattedText
but I tried to do it with ActiveDocument but result is the same. So how
can I reference to currently open doc.
Please help.
Regards,
sweet_dreams