Posts by ABDULLAH2015

Important Notice


Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

    Re: Word VBA to save a macro word file to an anormal word file


    Thanks cytop


    I attached a sample file for reference, this sample it has 2 tables as follows;


    1-First table contents some date linked from excel through VBA, if you click one of the numbers you can see that those numbers in said the text labels


    2- Second table which i'm trying to achieve , to make those number in-said the table without the text labels.




    Thanks

    Hi all


    I have word file and i'm using it for populate some data from excel to it , it's a macro file with some text label controllers.
    i'm trying to save the same file as it's with all the formatting to anew document but without the macros and labels controls but contents of labels should be there.

    Can someone help me with a macro for this?


    Thank in advance!!

    Re: Label Control Formatting in Word Doc VBA


    Thanks cytop for help


    and sorry for the late replay as i was on leave , it's work prefect. and my financial statement get populated from excel to word with no issues.


    My next step, will sending the word file to our auditors it sending with all the macros and text controlled label. so it's difficult for them to modify any number if it's required, so there is any way to write a macro to save a copy with a normal file without any controls or macros (just like any a normal word file).


    Thanks in advance
    Regards
    Abdullah

    I have the following code to link some data from excel workbook to word document and it's working fine, the result showing after running the code like this


    GW: 7982123
    RI : -5000000
    what should i add to my code so the end results should show the thousand separator and all negative numbers should be between () i.e


    GW : 7,982,123
    RI : (5,000,000)


    Can some one help me on this


    Regards
    Abdullah


    Code
    Private Sub CommandButton1_Click()Dim objExcel As New Excel.Application
    Dim exWb As Excel.Workbook
    Set exWb = objExcel.Workbooks.Open("C:\Users\alhaab\Desktop\Excel Macro for FS\FS 2014.xlsx")
    ThisDocument.UPR.Caption = exWb.Sheets("LC_IFRS").Cells(248, 3)
    ThisDocument.GW.Caption = exWb.Sheets("LC_IFRS").Cells(247, 3)
    exWb.Close
    Set exWb = Nothing
    End Sub

    Re: Attach multiple files to send in lotus note email


    Thank u John_w. for the quick responses


    This was helpful, one last question - is there any possibility to send those e-mail using the same code to send as encrypted e-mails as I,m using lotus notes to send those e-mail from excel VBA,.


    So Pls again required help on this


    Thanks in Advance


    Regards - Abdullah

    I'm trying to send an email with multiple attachments via VBA, I'm using the attached code to send the e-mails to many using cell references, this code can send only one attachment for each recipient but I need to add one more attachment to send, I tried several ways but it dosn.t work the second attachment is allocated in I11.


    Can some one help :)


    Abdullah


    Sub SendZIMESOA()
    Dim Subj As String, Msg As String
    Dim email(25) As Variant
    Dim cc(25) As Variant
    Dim r As Integer, x As Double
    Dim Maildb As Object, UserName As String, MailDbName As String, DomDbName As String
    Dim stFileName As String
    Dim MailDoc As Object, Session As Object
    Dim attachment As String
    Dim attachME As Object
    Dim EmbedObj As Object
    Dim resp As String
    Dim pw As String


    pw = InputBox("You are about to send e-mail Please confirm, Type (YES) to proceed")
    If pw <> "YES" Then
    MsgBox "Invalid Confirmation"
    Exit Sub
    Else
    Set Session = CreateObject("Notes.NotesSession")
    UserName = Session.UserName
    MailDbName = "mail\" & Mid$(UserName, 4, InStr(1, UserName, " ") - 4) & Mid$(UserName, _
    InStr(1, UserName, " ") + 1, InStr(1, UserName, "/") - InStr(1, UserName, " ") - 1) & ".nsf"
    Set Maildb = Session.GETDATABASE("", MailDbName)
    If Maildb.IsOpen = True Then
    Else: Maildb.OPENMAIL
    End If
    For r = Range("Distance").Offset(1, 0).Row To Range("distance").End(xlDown).Row
    Set MailDoc = Maildb.CreateDocument
    MailDoc.Form = "Memo"
    email(0) = Cells(r, 4)
    email(1) = Cells(r, 5)
    email(2) = Cells(r, 6)
    cc(0) = Cells(r, 6)
    cc(1) = Cells(r, 7)
    attachment = Cells(r, 8)
    'attachment = Cells(r, 9)
    Subj = Range("subject").Value
    Msg = ""
    Msg = Msg & Range("body1").Value & vbCrLf & vbCrLf
    Msg = Msg & Range("body2").Value & vbCrLf & vbCrLf
    Msg = Msg & Range("body3").Value & vbCrLf & vbCrLf
    Msg = Msg & Range("salutation").Value & vbCrLf & vbCrLf
    Msg = Msg & Range("sig1").Value & vbCrLf
    Msg = Msg & Range("sig2").Value & vbCrLf
    Msg = Msg & Range("sig3").Value & vbCrLf
    Msg = Msg & Range("sig4").Value & vbCrLf
    MailDoc.SendTo = email
    MailDoc.CopyTo = cc
    MailDoc.Subject = Subj
    MailDoc.Body = Msg
    MailDoc.SaveMessageOnSend = True
    MailDoc.PostedDate = Now
    If attachment <> "" Then
    Set attachME = MailDoc.CreateRichTextItem("Attachment")
    Set EmbedObj = attachME.EmbedObject(1454, "", attachment, "Attachment")


    End If


    MailDoc.PostedDate = Now()
    Call MailDoc.send(False)
    Next r
    Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing
    Exit Sub
    Audi:
    Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing
    End If
    End Sub




    Regards
    Abdullah