![]() |
|
|
|
#1
|
|||
|
|||
|
You are welcome, RobiNew! I've just slightly modified your code. And, really, I don't know a better code for doing this job. I think, your algorithm is quite fast and optimal. Maybe experts here, if they want, can offer a different solution. I'd like to have another good lesson! |
|
#2
|
|||
|
|||
|
Well, that was just a friendly comment! Perhaps you can explain why the code here below doesn't work at all. I want to go to the first page of the document without using Selection. Thanks!
Code:
Dim myRange As Range Set myRange = ActiveDocument.Content myRange.Collapse Direction:=wdCollapseStart |
|
#3
|
|||
|
|||
|
RobiNew, as for me,
selection.HomeKey wdStory is the best way of moving the cursor to the doc's start. If you don't like it, you can use ActiveDocument.range(0, 0).Select |
|
#4
|
|||
|
|||
|
Quote:
RobiNew Your code does work for what you are telling it to do. After running that code, the range is at the start of the document. Consider: Code:
Sub ScrahtchMacro() 'A basic Word Macro coded by Gregory K. Maxey Dim myRange As Range Set myRange = ActiveDocument.Content myRange.Collapse Direction:=wdCollapseStart myRange.InsertBefore "I'm here." lbl_Exit: Exit Sub End Sub If you want to start typing at the start of the document then you have to move the insert point to the start of the document as others have explained. |
|
#5
|
|||
|
|||
|
Yes, Greg, you are absolutely right! I was about to write this to RobiNew with the demonstration you used.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Find & Replace to insert thousands separators
|
jeffreybrown | Word | 3 | 10-19-2019 04:37 PM |
Find and replace condition
|
norgro | Word VBA | 2 | 07-31-2015 06:38 AM |
Find and Replace - How to insert brackets around all numbers in a doc
|
Natedogg | Word | 2 | 05-21-2015 07:16 AM |
Insert text at the end of a sentence Find/Replace
|
AlmostFriday | Word | 6 | 06-17-2012 05:21 AM |
| Find & Replace Insert Issue | mipacker | Word | 0 | 02-18-2009 08:59 AM |