Consulting

Results 1 to 4 of 4

Thread: VBA Convert Below outlook code to Late Binding....

  1. #1

    VBA Convert Below outlook code to Late Binding....

    Hi Team,
    
    
    Please assist me in converting below Outlook code into Late Binding.
    
    
    Situation - 1
    
    
    Dim doc As Word.Document
    Set doc = mi.GetInspector.WordEditor   ' How to Convert this line Late Binding
    
    
    Situation -2
    
    
    Dim olinsp As Outlook.Inspector  
    Dim wddoc As Word.Document 
    Set olinsp = .GetInspector '????? How to Convert this line Late Binding
    Set wddoc = olinsp.WordEditor  '?... How to Convert this line Late Binding
    
    
    Thanks in advance
    
    
    Regards,
    mg
    Attached Files Attached Files

  2. #2
    VBAX Expert Leith Ross's Avatar
    Joined
    Oct 2012
    Location
    San Francisco, California
    Posts
    518
    Location
    Hello naleeshg24,

    I haven't tested this code but try it and let me know the results.

    Option Explicit
    
    
    Sub test()
    
    
        Dim ol      As Object
        Dim mi      As Object
        Dim doc     As Object
        Dim msgbox  As String
        
        Const olMailItem As Long = 0
        
            Set doc = CreateObject("Word.Application")
            Set ol = CreateObject("Outlook.Application")
            
            Set mi = ol.CreateItem(olMailItem)
                mi.Display
                mi.To = "ABC.COM"
                mi.Subject = "movies"
        
            Set doc = mi.GetInspector.WordEditor
            msgbox = vbNewLine & vbNewLine & "Please Reply with question."
            doc.Range(0, 0).InsertAfter msgbox
        
            msgbox = vbNewLine & vbNewLine & "Please see chart Below:" & vbNewLine & vbNewLine
        
            Sheet1.ChartObjects(1).Chart.ChartArea.Copy
            doc.Range(0, 0).Paste
            Application.CutCopyMode = False
        
            doc.Range(0, 0).InsertAfter msgbox
            Sheet1.Range("A1").CurrentRegion.Copy
            doc.Range(1, 1).Paste
            Application.CutCopyMode = False
        
            msgbox = "Hi Team," & vbNewLine & vbNewLine & "Please see table below:" & vbNewLine
        
            doc.Range.InsertBefore Text:=msgbox
    
    
    End Sub
    Sincerely,
    Leith Ross

  3. #3
    Hi Leith,

    It worked thanks for your help. I wanted word to be late binding, its working.


    Regards,
    mg

  4. #4
    VBAX Expert Leith Ross's Avatar
    Joined
    Oct 2012
    Location
    San Francisco, California
    Posts
    518
    Location
    Hello malleshg24,

    That's great to hear. Glad I could help.
    Sincerely,
    Leith Ross

Posting Permissions

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