Outlook -- Compile Error
Amazing chart utilities from Jon Peltier
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Outlook -- Compile Error

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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"



    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!

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,169
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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
    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,169
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Good stuff now run Debug in VBE and see where it stopps that the code error.... highlighted..


    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

  6. #6
    New Member
    Join Date
    Mar 2002
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  7. #7
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    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.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com