M
marc
Hi. When I tried to run the vba macro below on a Word
document, the long variable "lLenLFileNam" equalled 8, on
the line containing the following code:
lLenLFileNam = InStrRev(strFulNam, "\")
On the next line, I tried to add 1 to lLenLFileNam, as
follows:
lCounter1 = lLenLFileNam + 1
Usually 8+1=9, but on this line lCounter1 was equal to 35.
What did I do wrong?
Thanks,
Marc
Here's my macro:
Private Sub btnPath1LevlHigher_Click()
'
' Macro recorded 8/23/2004 by Marc B. Hankin
'
frmMenuGnlAccess.Hide
Dim strFulNam As String, strPathFul As String,
strDirNamLow As String
Dim lLenLFileNam As Long, lCounter1 As Long,
lCounter2 As Long, lStrFulNam As Long
Dim MyPath As DataObject
Set MyPath = New DataObject
strFulNam = ActiveDocument.FullName
MsgBox strFulNam
lLenLFileNam = InStrRev(strFulNam, "\")
lCounter1 = lLenLFileNam + 1
lStrFulNam = Len(strFulNam)
lStrFulNam = lStrFulNam - lCounter1
strPathFul = Left(strFulNam, lStrFulNam)
lLenLFileNam = InStrRev(strPathFul, "\")
strFulNam = Left(strPathFul, lLenLFileNam)
'Selection.Text = strFulNam
'Selection.Text = strPathFul
MyPath.SetText strPathFul
MyPath.PutInClipboard
'
End Sub
document, the long variable "lLenLFileNam" equalled 8, on
the line containing the following code:
lLenLFileNam = InStrRev(strFulNam, "\")
On the next line, I tried to add 1 to lLenLFileNam, as
follows:
lCounter1 = lLenLFileNam + 1
Usually 8+1=9, but on this line lCounter1 was equal to 35.
What did I do wrong?
Thanks,
Marc
Here's my macro:
Private Sub btnPath1LevlHigher_Click()
'
' Macro recorded 8/23/2004 by Marc B. Hankin
'
frmMenuGnlAccess.Hide
Dim strFulNam As String, strPathFul As String,
strDirNamLow As String
Dim lLenLFileNam As Long, lCounter1 As Long,
lCounter2 As Long, lStrFulNam As Long
Dim MyPath As DataObject
Set MyPath = New DataObject
strFulNam = ActiveDocument.FullName
MsgBox strFulNam
lLenLFileNam = InStrRev(strFulNam, "\")
lCounter1 = lLenLFileNam + 1
lStrFulNam = Len(strFulNam)
lStrFulNam = lStrFulNam - lCounter1
strPathFul = Left(strFulNam, lStrFulNam)
lLenLFileNam = InStrRev(strPathFul, "\")
strFulNam = Left(strPathFul, lLenLFileNam)
'Selection.Text = strFulNam
'Selection.Text = strPathFul
MyPath.SetText strPathFul
MyPath.PutInClipboard
'
End Sub