Designware
Technical User
- Sep 24, 2002
- 202
Hi,
I am trying to use a macro to select, copy and paste a specific piece of data in a protected document. The data area is the 2nd unprotected area from the top of this document. While I'm in the protected document, I can manually click CTRL-HOME to take me to the top of the document, and then either the down-arrow, or the tab-key to take me to the desired area, and the entire data area is ALREADY selected. I am trying to duplicate this with a macro.
The very simple macro I have so far is:
Sub Macro1()
Selection.HomeKey Unit:=wdStory
Selection.MoveDown
End Sub
This gets me to the beginning of the desired data area, but nothing is selected. I have also tried "Selection.TypeText Text:=vbTab" in place of "Selection.MoveDown", but I get an error message.
I have also tried adding a Shift-End(Selection.EndKey Unit:=wdLine, Extend:=wdExtend) after the "Selection.MoveDown" to attempt to get the entire data area selected (as it does when you're manually keying it in). However, this simply takes the cursor to the end of the data area without selecting any text.
How do I get this data area selected for subsequent copying and pasting? The data area is NOT a defined number of characters. The user can type as much or as little as they wish into that area.
Thanks in advance for your help.
DSI
I am trying to use a macro to select, copy and paste a specific piece of data in a protected document. The data area is the 2nd unprotected area from the top of this document. While I'm in the protected document, I can manually click CTRL-HOME to take me to the top of the document, and then either the down-arrow, or the tab-key to take me to the desired area, and the entire data area is ALREADY selected. I am trying to duplicate this with a macro.
The very simple macro I have so far is:
Sub Macro1()
Selection.HomeKey Unit:=wdStory
Selection.MoveDown
End Sub
This gets me to the beginning of the desired data area, but nothing is selected. I have also tried "Selection.TypeText Text:=vbTab" in place of "Selection.MoveDown", but I get an error message.
I have also tried adding a Shift-End(Selection.EndKey Unit:=wdLine, Extend:=wdExtend) after the "Selection.MoveDown" to attempt to get the entire data area selected (as it does when you're manually keying it in). However, this simply takes the cursor to the end of the data area without selecting any text.
How do I get this data area selected for subsequent copying and pasting? The data area is NOT a defined number of characters. The user can type as much or as little as they wish into that area.
Thanks in advance for your help.
DSI