M
Marceepoo
I have a command button on a userform, and the button triggers the code
shown below [in the macro Private Sub btnPath_Click()], which works just
fine.
But I would like to remove most of the code from the form and instead
use the identical code, which I copied into my newmacros module, in a macro
(shown below) named: DocPath
I un-commented the line: 'Call DocPath [in the form's macro Private Sub
btnPath_Click()], , and I removed the rest of the code from Private Sub
btnPath_Click(), except for the line: End Sub
Now I get the error message: Compile Error: Can't find project or
library, and
the word "left" is highlighted in the macro DocPath.
Does anyone know why moving the code from the form to the NewMacros
module prevents vba from finding the project or library it needs?
Thanks for your help.
marceepoo
Private Sub btnPath_Click()
' Copy path to strVar and then to clipboard
' Macro recorded 8/22/2004 by Marc B. Hankin
'
frmMenuGnlAccess.Hide
'Call DocPath
Dim strFulNam As String, strPath As String
Dim lLenLFileNam As Long
Dim MyPath As DataObject
Set MyPath = New DataObject
strFulNam = ActiveDocument.FullName
lLenLFileNam = InStrRev(strFulNam, "\")
strPath = Left(strFulNam, lLenLFileNam)
MsgBox strFulNam & vbCrLf & strPath
MyPath.SetText strPath
MyPath.PutInClipboard
End Sub
Sub DocPath()
Dim strFulNam As String, strPath As String
Dim lLenLFileNam As Long
Dim MyPath As DataObject
Set MyPath = New DataObject
strFulNam = ActiveDocument.FullName
lLenLFileNam = InStrRev(strFulNam, "\")
strPath = Left(strFulNam, lLenLFileNam)
MsgBox strFulNam & vbCrLf & strPath
MyPath.SetText strPath
MyPath.PutInClipboard
End Sub
shown below [in the macro Private Sub btnPath_Click()], which works just
fine.
But I would like to remove most of the code from the form and instead
use the identical code, which I copied into my newmacros module, in a macro
(shown below) named: DocPath
I un-commented the line: 'Call DocPath [in the form's macro Private Sub
btnPath_Click()], , and I removed the rest of the code from Private Sub
btnPath_Click(), except for the line: End Sub
Now I get the error message: Compile Error: Can't find project or
library, and
the word "left" is highlighted in the macro DocPath.
Does anyone know why moving the code from the form to the NewMacros
module prevents vba from finding the project or library it needs?
Thanks for your help.
marceepoo
Private Sub btnPath_Click()
' Copy path to strVar and then to clipboard
' Macro recorded 8/22/2004 by Marc B. Hankin
'
frmMenuGnlAccess.Hide
'Call DocPath
Dim strFulNam As String, strPath As String
Dim lLenLFileNam As Long
Dim MyPath As DataObject
Set MyPath = New DataObject
strFulNam = ActiveDocument.FullName
lLenLFileNam = InStrRev(strFulNam, "\")
strPath = Left(strFulNam, lLenLFileNam)
MsgBox strFulNam & vbCrLf & strPath
MyPath.SetText strPath
MyPath.PutInClipboard
End Sub
Sub DocPath()
Dim strFulNam As String, strPath As String
Dim lLenLFileNam As Long
Dim MyPath As DataObject
Set MyPath = New DataObject
strFulNam = ActiveDocument.FullName
lLenLFileNam = InStrRev(strFulNam, "\")
strPath = Left(strFulNam, lLenLFileNam)
MsgBox strFulNam & vbCrLf & strPath
MyPath.SetText strPath
MyPath.PutInClipboard
End Sub