Group:  Microsoft Word ยป microsoft.public.word.setup.networking
Thread: Left function triggers Compile error: Can't find project or libra

Geek News

Left function triggers Compile error: Can't find project or libra
Marceepoo 1/29/2006 1:03:26 AM
The macro below works just fine...when it's located in a userform I
made, in which the macro is named: Private Sub btnPath_Click()
But I want to remove the macro from the userform, place the programming
in the NewMacros module of the same .dot file [but with the new name:
Boopsie()]), and have the Private Sub btnPath_Click macro call the boopsie
macro.
Unfortuntately, Boopsie doesn't work. Boopsie generates the following
error message: Compile error: Can't find project or library Ok Help
Does anyone have any ideas what is causing the problem, and how to fix it?
Thanks, Marceepoo

Here's the macro, as it appears in the NewMacros module of the same .dot file:

Sub Boopsie()
'
' Copy path to strVar and then to clipboard
'
'frmMenuGnlAccess.Hide
ActiveDocument.ActiveWindow.SetFocus
Dim strFulNam As String, strPath As String
Dim lLenLFileNam As Integer, lLenPthTemp As Integer
Dim MyPath As DataObject

Set MyPath = New DataObject

strFulNam = ActiveDocument.FullName

lLenPthTemp = Len(strFulNam)
lLenLFileNam = InStrRev(strFulNam, "\")
strPath = Left(strFulNam, lLenLFileNam)


'MsgBox strFulNam & vbCrLf & strPath
MyPath.SetText strPath
MyPath.PutInClipboard
'
End Sub

Re: Left function triggers Compile error: Can't find project or libra
"Doug Robbins - Word MVP" <dkr[ at ]REMOVETHISmvps.org> 1/29/2006 7:16:16 AM
No error here when running that code. What do you have checked under
Tools>References in the Visual Basic Editor?

Here I have the following (some of which maybe because of other
macros/add-ins loaded on my system)

Visual Basic For Applications
Microsoft Word 11.0 Object Library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft Forms 2.0 Object Library
Microsoft DAO 3.6 Object Library

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Marceepoo" <36c53a08-2073470544[ at ]news.postalias> wrote in message
news:8AB4B3D9-D993-47D4-9FD6-46F13B846EC6[ at ]microsoft.com...
[Quoted Text]
> The macro below works just fine...when it's located in a userform I
> made, in which the macro is named: Private Sub btnPath_Click()
> But I want to remove the macro from the userform, place the programming
> in the NewMacros module of the same .dot file [but with the new name:
> Boopsie()]), and have the Private Sub btnPath_Click macro call the boopsie
> macro.
> Unfortuntately, Boopsie doesn't work. Boopsie generates the following
> error message: Compile error: Can't find project or library Ok Help
> Does anyone have any ideas what is causing the problem, and how to fix
> it?
> Thanks, Marceepoo
>
> Here's the macro, as it appears in the NewMacros module of the same .dot
> file:
>
> Sub Boopsie()
> '
> ' Copy path to strVar and then to clipboard
> '
> 'frmMenuGnlAccess.Hide
> ActiveDocument.ActiveWindow.SetFocus
> Dim strFulNam As String, strPath As String
> Dim lLenLFileNam As Integer, lLenPthTemp As Integer
> Dim MyPath As DataObject
>
> Set MyPath = New DataObject
>
> strFulNam = ActiveDocument.FullName
>
> lLenPthTemp = Len(strFulNam)
> lLenLFileNam = InStrRev(strFulNam, "\")
> strPath = Left(strFulNam, lLenLFileNam)
>
>
> 'MsgBox strFulNam & vbCrLf & strPath
> MyPath.SetText strPath
> MyPath.PutInClipboard
> '
> End Sub
>


Re: Left function triggers Compile error: Can't find project or l
Marceepoo 1/30/2006 1:21:27 AM
Dear Doug:

1. Thanks for responding. 2.I found all of them checked, except
Microsoft DAO 3.6 Object Library; so I checked that one too. Then I closed
Word, reopened and ... still the same problem.
Any suggestions? (Thanks again for helping. It's much appreciated.)
Marceepoo

"Doug Robbins - Word MVP" wrote:

[Quoted Text]
> No error here when running that code. What do you have checked under
> Tools>References in the Visual Basic Editor?
>
> Here I have the following (some of which maybe because of other
> macros/add-ins loaded on my system)
>
> Visual Basic For Applications
> Microsoft Word 11.0 Object Library
> OLE Automation
> Microsoft Office 11.0 Object Library
> Microsoft Forms 2.0 Object Library
> Microsoft DAO 3.6 Object Library
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "Marceepoo" <36c53a08-2073470544[ at ]news.postalias> wrote in message
> news:8AB4B3D9-D993-47D4-9FD6-46F13B846EC6[ at ]microsoft.com...
> > The macro below works just fine...when it's located in a userform I
> > made, in which the macro is named: Private Sub btnPath_Click()
> > But I want to remove the macro from the userform, place the programming
> > in the NewMacros module of the same .dot file [but with the new name:
> > Boopsie()]), and have the Private Sub btnPath_Click macro call the boopsie
> > macro.
> > Unfortuntately, Boopsie doesn't work. Boopsie generates the following
> > error message: Compile error: Can't find project or library Ok Help
> > Does anyone have any ideas what is causing the problem, and how to fix
> > it?
> > Thanks, Marceepoo
> >
> > Here's the macro, as it appears in the NewMacros module of the same .dot
> > file:
> >
> > Sub Boopsie()
> > '
> > ' Copy path to strVar and then to clipboard
> > '
> > 'frmMenuGnlAccess.Hide
> > ActiveDocument.ActiveWindow.SetFocus
> > Dim strFulNam As String, strPath As String
> > Dim lLenLFileNam As Integer, lLenPthTemp As Integer
> > Dim MyPath As DataObject
> >
> > Set MyPath = New DataObject
> >
> > strFulNam = ActiveDocument.FullName
> >
> > lLenPthTemp = Len(strFulNam)
> > lLenLFileNam = InStrRev(strFulNam, "\")
> > strPath = Left(strFulNam, lLenLFileNam)
> >
> >
> > 'MsgBox strFulNam & vbCrLf & strPath
> > MyPath.SetText strPath
> > MyPath.PutInClipboard
> > '
> > End Sub
> >
>
>
>
Re: Left function triggers Compile error: Can't find project or l
"Doug Robbins - Word MVP" <dkr[ at ]REMOVETHISmvps.org> 1/30/2006 5:14:11 AM
Sorry, I do not get an error when running the following code here:

ActiveDocument.ActiveWindow.SetFocus
Dim strFulNam As String, strPath As String
Dim lLenLFileNam As Integer, lLenPthTemp As Integer
Dim MyPath As DataObject

Set MyPath = New DataObject

strFulNam = ActiveDocument.FullName

lLenPthTemp = Len(strFulNam)
lLenLFileNam = InStrRev(strFulNam, "\")
strPath = Left(strFulNam, lLenLFileNam)


MsgBox strFulNam & vbCrLf & strPath
MyPath.SetText strPath
MyPath.PutInClipboard

and if I then use Ctrl+c, the path of the active document is pasted into the
selection.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Marceepoo" <36c53a08-2073470544[ at ]news.postalias> wrote in message
news:B27624DE-B9A1-4518-A359-DCC7DEBA33B7[ at ]microsoft.com...
[Quoted Text]
> Dear Doug:
>
> 1. Thanks for responding. 2.I found all of them checked, except
> Microsoft DAO 3.6 Object Library; so I checked that one too. Then I
> closed
> Word, reopened and ... still the same problem.
> Any suggestions? (Thanks again for helping. It's much appreciated.)
> Marceepoo
>
> "Doug Robbins - Word MVP" wrote:
>
>> No error here when running that code. What do you have checked under
>> Tools>References in the Visual Basic Editor?
>>
>> Here I have the following (some of which maybe because of other
>> macros/add-ins loaded on my system)
>>
>> Visual Basic For Applications
>> Microsoft Word 11.0 Object Library
>> OLE Automation
>> Microsoft Office 11.0 Object Library
>> Microsoft Forms 2.0 Object Library
>> Microsoft DAO 3.6 Object Library
>>
>> --
>> Hope this helps.
>>
>> Please reply to the newsgroup unless you wish to avail yourself of my
>> services on a paid consulting basis.
>>
>> Doug Robbins - Word MVP
>>
>> "Marceepoo" <36c53a08-2073470544[ at ]news.postalias> wrote in message
>> news:8AB4B3D9-D993-47D4-9FD6-46F13B846EC6[ at ]microsoft.com...
>> > The macro below works just fine...when it's located in a userform I
>> > made, in which the macro is named: Private Sub btnPath_Click()
>> > But I want to remove the macro from the userform, place the
>> > programming
>> > in the NewMacros module of the same .dot file [but with the new name:
>> > Boopsie()]), and have the Private Sub btnPath_Click macro call the
>> > boopsie
>> > macro.
>> > Unfortuntately, Boopsie doesn't work. Boopsie generates the
>> > following
>> > error message: Compile error: Can't find project or library Ok
>> > Help
>> > Does anyone have any ideas what is causing the problem, and how to
>> > fix
>> > it?
>> > Thanks, Marceepoo
>> >
>> > Here's the macro, as it appears in the NewMacros module of the same
>> > .dot
>> > file:
>> >
>> > Sub Boopsie()
>> > '
>> > ' Copy path to strVar and then to clipboard
>> > '
>> > 'frmMenuGnlAccess.Hide
>> > ActiveDocument.ActiveWindow.SetFocus
>> > Dim strFulNam As String, strPath As String
>> > Dim lLenLFileNam As Integer, lLenPthTemp As Integer
>> > Dim MyPath As DataObject
>> >
>> > Set MyPath = New DataObject
>> >
>> > strFulNam = ActiveDocument.FullName
>> >
>> > lLenPthTemp = Len(strFulNam)
>> > lLenLFileNam = InStrRev(strFulNam, "\")
>> > strPath = Left(strFulNam, lLenLFileNam)
>> >
>> >
>> > 'MsgBox strFulNam & vbCrLf & strPath
>> > MyPath.SetText strPath
>> > MyPath.PutInClipboard
>> > '
>> > End Sub
>> >
>>
>>
>>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net