G
Guest
Apologies if this is the wrong forum. I normally post in the Word Programming
group, but this seemed like more of a VB.Net question.
I'm moving code from VBA over to Visual Studio Express 2005 (Visual Basic)
while still learning about VB.Net. (Not a good combination, I know.)
One problem I'm seeing is that certain lines of code that work when run
inside Word fail in a VB.Net app because I'm trying to set a read-only
property. For example, when dealing with the Range object in Word, in the VBA
Editor, you can write this:
dim r as Range
[blah blah blah]
r.Characters.Last= "T"
This should make the last character in the range "r" a capital T. It works
in the VBA Editor with no errors, but in Visual Studio Express, it tells me
"Last is a read-only property."
I tried creating a variable:
dim strTmp as String
strTmp=r.Characters.Last
strTmp="T"
But that doesn't work, because it won't let you assign "Last" to a string.
Any ideas?
Again, I wasn't certain where to put this, but I saw other Microsoft Word
questions here and figured I'd add my own. Thanks in advance!
group, but this seemed like more of a VB.Net question.
I'm moving code from VBA over to Visual Studio Express 2005 (Visual Basic)
while still learning about VB.Net. (Not a good combination, I know.)
One problem I'm seeing is that certain lines of code that work when run
inside Word fail in a VB.Net app because I'm trying to set a read-only
property. For example, when dealing with the Range object in Word, in the VBA
Editor, you can write this:
dim r as Range
[blah blah blah]
r.Characters.Last= "T"
This should make the last character in the range "r" a capital T. It works
in the VBA Editor with no errors, but in Visual Studio Express, it tells me
"Last is a read-only property."
I tried creating a variable:
dim strTmp as String
strTmp=r.Characters.Last
strTmp="T"
But that doesn't work, because it won't let you assign "Last" to a string.
Any ideas?
Again, I wasn't certain where to put this, but I saw other Microsoft Word
questions here and figured I'd add my own. Thanks in advance!