Results 1 to 2 of 2

Thread: Lotus notes body image alignment not happening

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2010
    Posts
    45

    Lotus notes body image alignment not happening

    Hi,

    I'am using below code to send automated mail by copying range from excel. But image (excel range) which is getting copied from excel range & pasted in Lotus notes new document is aligned to left. I want to make this "Center".

    any help on this..!!!

    Code:
    Public Function SendEMail()
    
    Dim thisWB  As String
    Dim newWB As String
    Dim Email As String
    Dim SendTo As String
    Dim EmailSubject As String
    Dim MyAttachment As String
    
    
        thisWB = ActiveWorkbook.Name
        
        On Error Resume Next
        Sheets("tempsheet").Delete
        On Error GoTo 0
        
        Sheets.Add
        ActiveSheet.Name = "tempsheet"
        Sheets("Data").Select
        
        If ActiveSheet.AutoFilterMode Then
            Cells.Select
            On Error Resume Next
            ActiveSheet.ShowAllData
            On Error GoTo 0
        End If
        
        Columns("A:A").Select
        Selection.Copy
        
        Sheets("tempsheet").Select
        Range("A1").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        
        
        If (Cells(1, 1) = "") Then
            lastrow = Cells(1, 1).End(xlDown).Row
            
            If lastrow <> Rows.Count Then
                Range("A1:A" & lastrow - 1).Select
                Selection.Delete Shift:=xlUp
            End If
        
        End If
        
        Columns("A:A").Select
        Columns("A:A").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("B1"), Unique:=True
        
        Columns("A:A").Delete
        
        Cells.Select
        Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
        
        lMaxSupp = Cells(Rows.Count, 1).End(xlUp).Row
        
        For suppNo = 2 To lMaxSupp
        
            Windows(thisWB).Activate
            SupName = Sheets("tempsheet").Range("A" & suppNo)
            
            If SupName <> "" Then
                
                Sheets("Data").Select
                Cells.Select
                
                ActiveSheet.Range("$A$1:$E$65000").AutoFilter Field:=1, Criteria1:="=" & SupName
                
                Columns("A:E").Select
                Range(Selection, Selection.End(xlUp)).Select
                Selection.Copy
                Sheets("Sheet5").Select
                Range("A1").Select
                ActiveSheet.Paste
                Cells.Select
                Cells.EntireColumn.AutoFit
                
                'Storing e-mail id into Email variable where email need to be sent
                Email = Range("E2").Value
                
                Range("A2:D2").Select
                Application.CutCopyMode = False
                Selection.Copy
                Sheets("Range").Select
                Range("B23").Select
                Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
                Range("A1").Select
            End If
                
      
        With Application
            .ScreenUpdating = False
            .DisplayAlerts = False
        End With
       
       '********************************************************************************************
       
    SendEMail = True
    
    Dim myRange As Range
    
    'Set E-mail format range
        Worksheets("Range").Activate
        Worksheets("Range").Range("A1:F44").Select
        Worksheets("Range").Range("A1:F44").Copy
    
    'On Error GoTo ErrorMsg
       
        Dim EmailList As Variant
        Dim ws, uidoc, session, db, uidb, NotesAttach, NotesDoc, objShell As Object
        Dim RichTextBody, RichTextAttachment As Object
        Dim server, mailfile, user, usersig As String
        Dim SubjectTxt, MsgTxt As String
               
        Set session = CreateObject("Notes.NotesSession")
        If session Is Nothing Then
            MsgBox "Sorry, unable to instantiate the Notes Session", vbOKOnly, "Unable to Continue"
            SendEMail = False
        End If
       
        user = session.UserName
        usersig = session.CommonUserName
        server = ""
        mailfile = session.GetEnvironmentString("MailFile", True)
       
        Set db = session.GetDatabase(server, mailfile)
        If Not db.IsOpen Then
            Call db.Open("", "")
            Exit Function
        End If
               
        If Not db.IsOpen Then
            MsgBox "Sorry, unable to open: " & mailfile, vbOK, "Unable to Continue"
            SendEMail = False
        End If
        
        Set NotesDoc = db.createdocument
        
        With NotesDoc
            .form = "Memo"
            .Subject = "ECS Transaction Pre-Hit Intimation" 'The subject line in the email
            .Principal = user
            .SendTo = Email  'e-mail ID variable to identify whom email need to be sent
        End With
        
        Set RichTextBody = NotesDoc.CreateRichTextItem("Body")
            
       With NotesDoc
            .computewithform False, False
            '.SAVEMESSAGEONSEND = True
            .Doc_Category = "Business Secret"
            '.Save True, False, True
        End With
            
       'Now set the front end stuff
       Set ws = CreateObject("Notes.NotesUIWorkspace")
       If Not ws Is Nothing Then
       Set uidoc = ws.editdocument(True, NotesDoc)
       
        If Not uidoc Is Nothing Then
             If uidoc.editmode Then
               Call uidoc.gotofield("Body")
               Call uidoc.Paste
             End If
         End If
       End If
       
       Call uidoc.SEND
        Call uidoc.Close
       
       With NotesDoc
            .Doc_Category = "Business Secret"
            .PostedDate = Now()
            '.Save True, False, True
            '.SaveOptions = "0"
            '.SEND False
       End With
        
       
       'close connection to free memory
        Set session = Nothing
        Set db = Nothing
        Set NotesAttach = Nothing
        Set NotesDoc = Nothing
        Set uidoc = Nothing
        Set ws = Nothing
        
    'ErrorMsg:
    '    SendEMail = False
    '    If Err.Number = 7225 Then
    '            MsgBox "The file " & Range("Fname_NZ_VaR") & " cannot be found in the location " & Range("Path_NZ_VaR"), vbOKOnly, "Error"
    '    ElseIf Err.Number = 1004 Then
    '            MsgBox "One of the following may be causing an error:" & vbCrLf & "1. The range 'Path_NZ_VaR' and/or 'Fname_NZ_VaR' does not exist in this spreadsheet," & _
    '            vbCrLf & "2. The range 'Fname_NZ_VaR' does not contain a filename," & vbCrLf & "3. The path " & Range("Path_NZ_VaR") & " does not exist.", vbOKOnly, "Error"
    '    Else
    '            MsgBox Err.Number & Err.Description
     '   End If
    
    'Exit Function
       
    Next
                Sheets("tempsheet").Delete
                Sheets("Total Data").Select
        
                If ActiveSheet.AutoFilterMode Then
                    Cells.Select
                    ActiveSheet.ShowAllData
                End If
    End Function

  2. #2

    Thread Starter
    Member
    Join Date
    Aug 2010
    Posts
    45

    Re: Lotus notes body image alignment not happening

    I was wondering if i can set body text alignment to default as center instead of left so that every newly created lotus notes document is aligned to "Center" by default.

    Or other solution could be if i can use HTML in my code to resolve this issue. But i don't know how to use it.

    any idea on this !!!

Posting Permissions

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



Click Here to Expand Forum to Full Width