L
LEU
What am I doing wrong? I have the following macro that is not working. I copy
a document from the network to my C drive, then in a new document I open my
form and run this macro:
Sub CmdPaste1_Click()
Dim DocA As Document
Set DocA = Documents.Open("c:\Temp.doc")
Set oBM = ActiveDocument.Bookmarks
With DocA
Text3.Value = oBM("Text41").Range.Text
Text4.Value = oBM("Text27").Range.Text
Text5.Value = oBM("Text28").Range.Text
Text6.Value = oBM("Text16").Range.Text
Cmb1.Value = oBM("DropDown1").Range.Text
Cmb2.Value = oBM("DropDown2").Range.Text
Cmb3.Value = oBM("DropDown3").Range.Text
DocA.Close wdDoNotSaveChanges
End With
Kill "c:\Temp.doc"
End Sub
What it does when it runs is it puts the word FORMTEXT at the beginning of
each text field. Instead of putting the text from DropDown1, 2 & 3, it puts
the word DROPDOWN in Cmd1, 2 & 3. Then if I click on my OK button on my form
to save the info to the document, it gives me a run-time error that says
Object has been deleted.
a document from the network to my C drive, then in a new document I open my
form and run this macro:
Sub CmdPaste1_Click()
Dim DocA As Document
Set DocA = Documents.Open("c:\Temp.doc")
Set oBM = ActiveDocument.Bookmarks
With DocA
Text3.Value = oBM("Text41").Range.Text
Text4.Value = oBM("Text27").Range.Text
Text5.Value = oBM("Text28").Range.Text
Text6.Value = oBM("Text16").Range.Text
Cmb1.Value = oBM("DropDown1").Range.Text
Cmb2.Value = oBM("DropDown2").Range.Text
Cmb3.Value = oBM("DropDown3").Range.Text
DocA.Close wdDoNotSaveChanges
End With
Kill "c:\Temp.doc"
End Sub
What it does when it runs is it puts the word FORMTEXT at the beginning of
each text field. Instead of putting the text from DropDown1, 2 & 3, it puts
the word DROPDOWN in Cmd1, 2 & 3. Then if I click on my OK button on my form
to save the info to the document, it gives me a run-time error that says
Object has been deleted.