Outlook -- Compile Error

CesarH

New Member
Joined
Mar 24, 2002
Messages
3
Below is code for a form that emails from within excel. The code works great off my work station but when I upload it to the server that's on the network and run the form on the excel sheet it comes up with a compile error: "Can't find project or library"

compilerror.gif


Private Sub sendMsg_Click()
Dim objOL As New Outlook.Application
Dim objMail As MailItem

On Error Resume Next

Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = "chernandez@udi-flair.com"
.Subject = "Item Master FIMS Request"
.Body = Format(Frame2.Caption, ">") & vbNewLine & vbNewLine & "Please change the following... " & vbNewLine & vbNewLine & (TextBox1.Text) & " = CAT# CHANGE. " & vbNewLine & vbNewLine & _
Format(ComboBox1.Text) & " = ITEM CLASS. " & vbNewLine & (TextBox3.Text) & " = DESCRIPTION. " & vbNewLine & (ComboBox2.Text) & " = MAKE or BUY. " & vbNewLine & _
Format(ComboBox3.Text) & " = RCVNG INSPECTION. " & vbNewLine & (ComboBox4.Text) & " = INVENTORY TYPE. " & vbNewLine & (ComboBox5.Text) & " = ENGINEERING CATEGORY. " & vbNewLine & _
Format(ComboBox6.Text) & " = MSDS. " & vbNewLine & (ComboBox8.Text) & " = ASME. " & vbNewLine & (ComboBox15.Text) & " = SPARE PARTS. " & vbNewLine & vbNewLine & _
Format(Frame3.Caption, ">") & vbNewLine & vbNewLine & (Label16.Caption) & (Label27.Caption) & vbNewLine & (Label17.Caption) & (Label28.Caption) & vbNewLine & _
Format(Label18.Caption) & (Label29.Caption) & vbNewLine & (Label19.Caption) & (Label30.Caption) & vbNewLine & (Label20.Caption) & (Label31.Caption) & vbNewLine & _
Format(Label21.Caption) & (Label32.Caption) & vbNewLine & (Label22.Caption) & (Label33.Caption) & vbNewLine & (Label23.Caption) & (Label34.Caption) & vbNewLine & _
Format(Label24.Caption) & (Label35.Caption) & vbNewLine & (Label25.Caption) & (Label36.Caption) & vbNewLine & (Label26.Caption) & (Label37.Caption) & vbNewLine & vbNewLine & _
Format(Frame1.Caption, ">") & " = " & (TextBox2.Text) & ", System = " & (ComboBox9.Text) & vbNewLine & vbNewLine & _
Format(Frame4.Caption, ">") & vbNewLine & "LINE 1: " & (TextBox9.Text) & vbNewLine & "LINE 2: " & (TextBox11.Text) & vbNewLine & "Purchasing Notes = " & (TextBox10.Text) & vbNewLine & "Special Instructions = " & (TextBox12.Text) & vbNewLine & vbNewLine
.FlagRequest = "Item Master FIMS Request"
.Importance = olImportanceHigh
.Send
End With
Set objMail = Nothing
Set objOL = Nothing
cmdExit.SetFocus
End Sub

Thanks in advance for your time and support!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi

I can test the code as not my server and so on.. but soon as this kinda code is on such systems problem can occur, million of reasons.

I would write and load from residant PC or if needs be server, then should be ok.

Ermm thinking....... who do i say a printer configured on Win95 over Novel will bounce out if straight file print to printer Q2Jack is chosen , see the network calls this printer S2Jack to VBA fill fail

Does this make sence? So the codes need to be whatthe server knows not the PC log on and so on....

Does that help....

I can fix as cant see the set up hands on... need advice from IT Dept
 
Upvote 0
Thanks for your quick reply! I solved part of my problem but the still have another challenge.

I changed the first line from:

Private Sub sendMsg_Click()

To:

Public Sub sendMsg_Click()

This works great on the network only on regular WIN9X stations. The challenge is still there with the complie error on the NT stations. If anyone has any suggestions please reply.

Thanks for your support!!
Cesar
 
Upvote 0
Hi,

Are you still getting the missing library error?

Have you checked your references?

Probably need to remap a reference or two.

Click on Tools, References in VBA environment.

Your reference is probably WindowsSystem
or
WindowsSystem32

It need to be changed to WINNTSystem
or
WINNTSystem32

Tom
This message was edited by TsTom on 2002-03-25 17:19
 
Upvote 0
Tom:

Thanks for your reply! The problem still exists on the NT stations. I did check and change reference library to reflect the Microsoft Outlook 9.0 Object library. How do I set the paths in code to reflect both Object libraries for the WIN9X & WINNT stations??

Thanks in advance for your time and support!!!

Cesar
 
Upvote 0
Hi
I don't really know?
There may be a more sophisicated way, but one way would be to trap the error and handle it in a routine.
For instance, set the default path for the operating system you use most frequently. When you get a run-time error, trap the error, check the err.number and try the other path, then Resume Next.
That would work.
 
Upvote 0

Forum statistics

Threads
1,213,517
Messages
6,114,085
Members
448,548
Latest member
harryls

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top