S
Stephen D. Oliver
I'm sure everyone knows about how you can type "=rand(x,y)" (minus the
quotation marks) into a Word doc and have it automatically populate the doc
with "dummy text." (It works in Word 2003 and Word 2007 but uses different
dummy text for each version.)
Well, I had the grand idea of automating that by using a Word VBA macro that
typed the function directly on to the document surface and then inserted a
carriage return.
I'm a bit baffled as to why, but for some reason that doesn't work. I use
this code:
Sub AddDummyText()
Selection.TypeText ("=rand(2,4)")
SendKeys "{ENTER}", True
End Sub
When you run that code, the insertion point stays just behind the last
parens and basically nothing happens. I tried this as well:
Sub AddText()
Selection.TypeText ("=rand(2,4)")
Selection.InsertParagraph
End Sub
That didn't work either. The frustrating part is you can switch to the doc
and then just hit Enter and it works as advertised.
Has anyone run into this before?
-so
quotation marks) into a Word doc and have it automatically populate the doc
with "dummy text." (It works in Word 2003 and Word 2007 but uses different
dummy text for each version.)
Well, I had the grand idea of automating that by using a Word VBA macro that
typed the function directly on to the document surface and then inserted a
carriage return.
I'm a bit baffled as to why, but for some reason that doesn't work. I use
this code:
Sub AddDummyText()
Selection.TypeText ("=rand(2,4)")
SendKeys "{ENTER}", True
End Sub
When you run that code, the insertion point stays just behind the last
parens and basically nothing happens. I tried this as well:
Sub AddText()
Selection.TypeText ("=rand(2,4)")
Selection.InsertParagraph
End Sub
That didn't work either. The frustrating part is you can switch to the doc
and then just hit Enter and it works as advertised.
Has anyone run into this before?
-so