Illustrator VBA scripting 101 - via Excel

This post will attempt to introduce newcomers to Illustrator Visual Basic Scripting (well, not actually vbs, but rather tru VBA, Visual Basic for Applications). I personally prefer vba over bvs for a number of reasons. First, I always have Excel and Illustrator open, so it makes sense for me use it to drive Ai. Second, I usually need to transfer data between the two programs. Third...I love the Excel IDE...ok, let's get right into it.
- Open Excel
- hit Alt+F11, to bring up the editor
- in the Tools menu, click on References...
- add a reference to "Adobe Illustrator CS5 Type Library"
- in the Personal.xls (or in any other book) add a Module. Personal is a global workbook that is always available. If you don't see it, go back to Excel and record a macro, anything will do. That will create the Personal file.
- and type the following in that module
- we have to continue the tradition and do the "HelloWorld" script
Sub helloWorld()
    Dim iapp As New Illustrator.Application
    Dim idoc As Illustrator.Document
    Dim iframe As Illustrator.TextFrame
    Set idoc = iapp.ActiveDocument
    Set iframe = idoc.TextFrames.Add
    iframe.Contents = "Hello World from Excel VBA!!"
    Set iframe = Nothing
    Set idoc = Nothing
    Set iapp = Nothing
End Sub
- save Personal book
- open Illustrator and create a new document first
- to run, move the cursor anywhere inside the Sub...End Sub and hit F5
that's it for now...in the following posts we'll move the text to the middle of the page, create new documents, get data from an Excel Range to Illustrator, get data from Illustrator text frame to an Excel Range...and more, hopefully.
questions? comments?

Lesson 4: Creating Shapes, Working with Selections, writing data to Excel
In the Illustrator world a shape is a....well, I'm not going to bore you with technical terms only rocket scientists would understand....let's just say a Circle is a shape, as well as a Rectangle or a Star, there much better than the actual definition. Then in the scripting lingo all shapes are pathItems.
There are a number of ways of creating shapes, in this exercise well focus on using the various Methods of the PathItem Object.
to create a Circle we'll use the Ellipse Method, all arguments are optional, if we don't supply any, the method uses default values.
Ellipse
([top as Double]
[, left as Double]
[, width as Double]
[, height as Double]
[, reversed as Boolean]
[, inscribed as Boolean])
Dim icircle As Illustrator.PathItem
Set icircle = idoc.PathItems.Ellipse(300, 300, 100, 100)
similarly, to create a square, we use the Rectangle Method
Dim isquare As Illustrator.PathItem
Set isquare = idoc.PathItems.Rectangle(200, 200, 100, 100)
and to make a star we use the...hum...the Star Method
Dim istar As Illustrator.PathItem
Set istar = idoc.PathItems.Star(400, 400, 100, 50, 5)
now lets select the square and read some of its properties and write them down to Excel
isquare.Selected = True
get properties of the top most selection, in case we have many items selected, for now it should only be the square
    w = idoc.Selection(0).Width
    h = idoc.Selection(0).Height
    y = idoc.Selection(0).top
    x = idoc.Selection(0).left
and lets write those values to Excel, using the Cells object this time. Make sure you have a blank Excel book open, it will write data to the first 4 rows, 2 first columns
    Cells(1, 1) = "width: "
    Cells(1, 2) = w
    Cells(2, 1) = "height: "
    Cells(2, 2) = h
    Cells(3, 1) = "top: "
    Cells(3, 2) = y
    Cells(4, 1) = "left: "
    Cells(4, 2) = x
here's the complete code, from now on, we'll start every exercise with a blank Excel book and a blank Illustrator document, so please do that before runing.
Sub lesson4shapes()
    Dim iapp As New Illustrator.Application
    Dim idoc As Illustrator.Document
    Dim icircle As Illustrator.PathItem
    Dim isquare As Illustrator.PathItem
    Dim istar As Illustrator.PathItem
    Set idoc = iapp.ActiveDocument
    Set icircle = idoc.PathItems.Ellipse(300, 300, 100, 100)
    Set isquare = idoc.PathItems.Rectangle(200, 200, 100, 100)
    Set istar = idoc.PathItems.Star(400, 400, 100, 50, 5)
    isquare.Selected = True
    w = idoc.Selection(0).Width
    h = idoc.Selection(0).Height
    y = idoc.Selection(0).top
    x = idoc.Selection(0).left
    Cells(1, 1) = "width: "
    Cells(1, 2) = w
    Cells(2, 1) = "height: "
    Cells(2, 2) = h
    Cells(3, 1) = "top: "
    Cells(3, 2) = y
    Cells(4, 1) = "left: "
    Cells(4, 2) = x
    Set istar = Nothing
    Set isquare = Nothing
    Set icircle = Nothing
    Set idoc = Nothing
    Set iapp = Nothing
End Sub
Note that the code we just wrote is not the most efficient way of doing things, we don't have to select an object in order to work on it (get the properties for instance). We did it for illustration purposes, we could also use a loop to write data to Excel. We'll do that in the next lesson.
also, note that the top/left values don't match exactly with the values we entered (200, 200), homework, can you tell why?

Similar Messages

  • VBA Script Errors on Excel Cell containing a Formula

    I'm writing a VBA script.  When running the script I have a varible being set from a Excel cell containing a formula.  The script errors on this staement.  See below
            Range("O10").Select
            BlockSize = ActiveCell.FormulaR1C1 ' DID Block Size
    Cell O10 contains "=VLOOKUP(A1,SP_DID_Range!A:Q,10,FALSE)"
    The above formula produces the value 20
    What I receive is the formula instead of value the formula produces.
    I am trying retrieve the value and use it in another formula.  So "BlockSize" should equal 20 not "=VLOOKUP(A1,SP_DID_Range!A:Q,10,FALSE)"

    If you want the A1-style formula, use the Formula property.
    If you want the R1C1-style formula, use the FormulaR1C1 property.
    If you want the value, use the Value property:
        BlockSize = Range("O10").Value
    Note that it isn't necessary to select the cell.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Error in Excel VBA script while using sharepoint web service

    Hi Can you please help me out  in this ?
    nain1987

    Hi Nain,
    According to your description, my understanding is that the error occurred in the Excel VBA scripts which was used to update SharePoint list.
    I recommend to check if the URL of the web service is in the right scope. If the list is in a subsite, the URL should be: http://servername/site/ _vti_bin/Lists.asmx.
    To update SharePoint list using Excel VBA script, you can refer to the link below:
    http://sharepoint.stackexchange.com/questions/34433/update-sharepoint-list-using-excel
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • VBA command changed in Excel 2010?

    We recently upgraded to Excel 2010, and a macro that always worked perfectly in 2007 is behaving strangely now.
    I use the following command to insert a picture into Microsoft Excel:
    Set pic = ActiveSheet.Pictures.Insert("C:\Pictures\Example.tif")
    (Sorry for not inserting the above in a code block, but my web browser kept timing out while waiting for it.)
    That VBA command used to work flawlessly, but ever since I upgraded to Office 2010 and email my new workbook with a picture added via a macro to anybody else
    on site, the picture is gone with this error message in its place:
    "The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location."
    What changed in Excel 2010 to cause my VBA script to insert a LINK to a picture instead of embedding the actual picture?  Does anybody with a similar
    macro have this problem?

    Hey G North,
    I had added a workaround to my code, but your one (1) line offers a better solution. 
    And you're right . . . my original code did include the top, left, height, and width parameters, and this was the workaround I came up with:
    Dim pic As Picture, rng As Range
    Set pic = ActiveSheet.Pictures.Insert("C:\Pictures\Example.tif")
    Set rng = ActiveWindow.RangeSelection
    With pic
    .Top = ActiveCell.Top
    .Left = ActiveCell.Left
    .ShapeRange.LockAspectRatio = msoFalse
    Resize the picture's Height and Width
    to match the Current Range.
    .ShapeRange.Height = rng.RowHeight
    .ShapeRange.Width = rng.Width
    .Placement = xlMoveAndSize
    .Cut
    End With
    ActiveSheet.Pictures.Paste.Select
    You'll notice that after I inserted my picture and resized it to fit the active range, I CUT it and then PASTED it in that same range as a PICTURE.
    But again, your single line of code is preferable.
    Thanks again!

  • CS2 VBA Scripts in CS5

    Hi everyone, I am using VBA via MS Excel to import data into InDesign CS2 templates. I am considering upgrading to CS5. Should my VBA scripts work in CS5, or do you suspect there would be a problem?
    Thanks everyone,
    Mike

    Mike,
    I split your question off to a new thread. Please don't tag questions onto other threads.
    The answer to your question depends on what's in your script, but there's quite a few changes to the object model from CS2 to CS5. You can try putting it into a version folder (i.e. "Version 4.0 Scripts").
    Harbs

  • Macro/VBA script to merge rows with same values in another column

    Hi.
    I'm developing a dance competition application, using Excel 2010, and have so far managed to put judges' marked scores into a worksheet through a userform.
    Now I would like to make the worksheet more presentable as a scoreboard, as you would manually, but via VBA scripts.
    Exhibit Numbers (Column G) are unique identifiers (per competition) for contestants and each contestant is typically judged by three judges.  The scores in three separate categories from one judge would spread in one row so each contestant would have three
    rows.
    I would like to merge rows of columns where the totals from the judges go (Columns P to U) for each contestant.
    I've considered using some kind of loop but I don't have enough experience in vba scripting, it gets overcomplicated. Could someone please help?
    Many thanks.
    Maki Koyama (Canberra, AUS)

    Hi,
    You cannot add a static "Y" inside a when looping over "i". You need to ensure that "Y" changes along with X. Try the modified code below.
    List elements = new ArrayList();
    for (int i=0; i<XXX; i++) {
    IZZZ.IVisibilityElement el = wdContext.createVisibilityElement();
    el.setVisAttr(i); // Change Y to i
    elements.add(el);
    wdContext.nodeVisibility().bind(elements);
    That should give you an idea of what is erroneous in the code.
    Thanks.
    HTH.
    p256960

  • Create adobe illustrator rectangle script?

    hi, this is a vba script that works in corel draw. I want it to work in illustrator instead but I don't know how to ammend it into javascript and adobe scripting language! Can anybody help??
    what it does:
    with an object selected
    I run script
    it creates around the selected object a thin rectangle with a margin from the object of 0.05cm
    then groups the object and rectangle togeather
    thats it
    Martin
    Sub makeRect()
        Dim s As Shape, sRect As Shape
        Dim x As Double, y#, h#, w#
        Dim dMarg#
        Dim sr As New ShapeRange
        dMarg = 0.05
        ActiveDocument.Unit = cdrCentimeter
        Set s = ActiveShape
        If s Is Nothing Then Exit Sub
        s.GetBoundingBox x, y, w, h
        Set sRect = ActiveLayer.CreateRectangle2(x - dMarg, y - dMarg, w + (dMarg * 2), h + (dMarg * 2))
        sRect.Outline.Width = 0.001
        sRect.CreateSelection
        sr.Add sRect
        sr.Add s
        sr.Group
    End Sub

    ok, good, the options for you are
    - if you have Excel or other Office application, and if you don't mind having Excel open and running your scripts from there then I can show you how to translate the corel script to illustrator using VBA, since you're more familiar with it.
    - or start from scratch and translate the script to Javascript and run it directly from within Illustrator...it will need more effort on your part to understand the new language....
    but either way at the end more beneficial to you, better yet if you learn both languages.

  • VBA script for automatically indexing topics

    A big disadvantage with InDesign's indexing system is that you cannot automatically index all occurences of topics currently in the index.
    Instead, you have to find an occurence of each topic in the document itself and go to the Index menus and then click New Page Reference...Add All, for each index topic individually.
    To get around this, I have been trying to produce a VBA script to automatically index all occurrences in a document of the topics currently in the document index.
    I have been using the MS Excel VBA development environment but find the definitions of the object model in the Excel VBA browser rather inadequate and ambiguous .
    Is there a more thorough reference work for these?
    The plan was to start by taking each individual topic in the index which I tried to access with something along the lines of:
    MyDocument.Index.Topic(1)
    This hasn't worked.
    The plan then was to take each index topic and use it to find an occurence in the document of that topic and then use that occurence to invoke the New Page Reference...Add All option to index all occcurences of that selected term, using something like:
    MyDocument.PageReferences.Add
    Again, without success.
    Any guidance or suggestions would be appreciated.

    Dear Peter,
    Many thanks for your posting, that was very helpful.
    This is the state of the script so far (I have added a large number of MsgBox entries - these aren't needed, they are just for debugging purposes during development):
    'VBA script which tries to work through all of the topics in the index and automatically index each occurence of them in the current text frame:
    main
    Function main()
    Set MyInDesign = CreateObject("InDesign.Application.CS4")
    If MyInDesign.Documents.Count > 0 Then
        Set MyDocument = MyInDesign.ActiveDocument
        Set MyPage = MyDocument.Pages.Item(1)
        Set MyTextFrame = MyPage.TextFrames.Item(1)
        Set MyStory = MyTextFrame.ParentStory
        Set MyIndex = MyDocument.Indexes(1)
        Set MyTopics = MyIndex.AllTopics
        MyIndexesCount = MyDocument.Indexes.Count
        MsgBox "Current indexes Count: " & MyIndexesCount
        MyIndexTopicsCount = MyTopics.Count
        MsgBox "Current index topics Count: " & MyIndexTopicsCount
        For i = 1 To MyTopics.Count Step 1 'work through the topics
    MyIndexTerm=MyTopics(i)
    MsgBox "Current indexes Topic: " & MyIndexTerm
    'search for MyIndexTerm :
            'Clear Find preferences:
            MyInDesign.FindTextPreferences = idNothingEnum.idNothing
            'Set up search paramaters:
            If MyIndexTerm <> "" Then
                MyInDesign.FindTextPreferences.FindWhat = MyIndexTerm
                'Set search options:
                MyInDesign.FindChangeTextOptions.CaseSensitive = False
                MyInDesign.FindChangeTextOptions.IncludeFootnotes = False
                MyInDesign.FindChangeTextOptions.IncludeHiddenLayers = False
                MyInDesign.FindChangeTextOptions.IncludeLockedLayersForFind = False
                MyInDesign.FindChangeTextOptions.IncludeLockedStoriesForFind = False
                MyInDesign.FindChangeTextOptions.IncludeMasterPages = False
                MyInDesign.FindChangeTextOptions.WholeWord = False
                'Search for the string:
                Set MyFoundItems = MyDocument.FindText 'this ought to be limited to the Story, not the Document eg MyStory
             MsgBox "Found index terms:" & MyFoundItems.Count
                For j = MyFoundItems.Count To 1 Step -1
                   MyTopics(i).PageReferences.Add MyFoundItems(j)
                Next
               'Clear preference:
                MyInDesign.FindTextPreferences = idNothingEnum.idNothing
                'Having found it, add page reference:
             'MyDocument.PageReferences.Add
            Else
                MsgBox "No search term specified"
            End If
    Response=MsgBox ("Continue?", vbYesNo)
    If Response = vbNo then
      Exit For
    End If
       Next
    'Set up Index options:
    MyIndex.IndexOptions.Title = "Index"
    MyIndex.IndexOptions(1).TitleStyle="Chapter Head"
    MyIndex.IndexOptions(1).ReplaceExistingIndex = True
    'Generate the index:
    MyIndex.Generate
    Else
        MsgBox ("Please open a document, select an object, and try again.")
    End If
    End Function
    There are a couple of problem areas still:
    1. Index terms appear to be added irrespective of whether or not that particular page reference already exists in the index.
    This can result in duplicate page references under each topic - especially if the script is run several times.
    Is there any way of avoiding these duplicate references?
    2. I haven't yet suceeded in getting the script to generate the index - so far I've had to do it manually after the script has run.
    The problem lies somewhere in the code to set up the index options and then generate the index.
    3. It might be useful to be able to limit the indexing to the curent story rather than the whole document - but I haven't yet got it to do that.
    Best wishes.

  • HELP!! Using a vba script in Outlook to copy attachments to c:\temp folders automatically

    Hi
    I'm brand new to Visual Basic really - you will be able to tell that I am a complete beginner. I wouldn't be posting here but I had tried asking other Forums but have not got any responses.
    This is the problem:- I've found a basic VB script to copy attachments within Outlook 2000 Inbox to the c:temp folder when a new email arrives in. When I debug the script in Outlook > Tools > Macros , it just seems to loop round and round within the
    top function called Application_Startup () and never attempts the objInbox_ItemAdd() function which is the important part. Please can anyone say what is wrong.
    I'm putting all this code within Project1 > Microsoft Outlook Objects > This OutlookSession - I bet I'm putting all this code in the wrong place aren't I? Please help anyone.
    Dim WithEvents objInbox As Outlook.Items
    Private Sub Application_Startup()
    Set objInbox = Session.GetDefaultFolder(olFolderInbox).Items
    End Sub
    Private Sub objInbox_ItemAdd(ByVal Item As Object)
    If Item.Class = olMail Then
    If Item.Attachments.Count > 0 Then
    Dim objAttachments As Outlook.Attachments
    Set objAttachments = Item.Attachments
    For Each objAttach In objAttachments
    ' Does not handle duplicate filename scenarios
    objAttach.SaveAsFile "C:\temp" & objAttach.FileName
    Next
    Set objAttachments = Nothing
    End If
    End If
    End Sub
    Also, I've set the Security to Low within Outlook > Tools> Macros > Security and a bit baffled why this won't run.
    Just for info, I got this VBScript solution from:-
    Outlook Visual Basic for Applications Rules
    Kind Regards
    Matt
    p.s I'm stuck with Outlook 2000 due to a limitation with some Legacy software that my company is still using.

    Thanks jrv.
    At the moment - I don't have the time to learn VBA better along with learning the other things I have an intested in already (e.g. PowerScript) - My customer has an outstanding fault which need fixing urgently. I've spent about 5 hours so fa trying to get
    a VBA script to work withing Outlook but to no avail. I might ask around my company to see if any one else can help or post this on a non-Microsoft forum I think.
    Cheers all the same
    Matt
    So you sold a job to do something you do not knowhow to do.  You are getting paid.  It is your job to learn or to hire someone with the skills you have sold.  We cannot produce custom scripts for an obsolete version of Outlook 2000.. 
    O2000 is almost 15 years old. It is not secure as no security patches have been released for it for almost 10 years.  It is old technology which none of us care to remember unless you want to pay us for the assistance.
    Here is the link to the instructions in th KB that you completely ignored:
    http://support.microsoft.com/kb/235852/EN-US
    It shows you exactly how to do this in Outlook 2000.  You must read all of the instructions carefully.  YOu must try all example code and be sure you understand how it works.  Post all issues with how to use VBA in the Outlook VBA developers
    forum AFTER you have tried that code and have a specific question and not just a requirement for someone to fix this for you.
    The code in the article is explicit to Outlook 2000.  The code you are using is only usable in Outlook 2002 and later.,  You must follow the examples for Outlook 2000 as outlined in your original article.
    If you want to be a technician you need to learn all of these things.  Just knowing how to install a PC is not sufficient if you are going to be a contractor.
    VBA is VBA.  Posting here will not change that.  This is an Admin scarping forum and not an office VBA forum.  VBA is NOT VBScript.  No matter how much it looks like VBScript it is not.
    You cannot just copy VBScript into a VBA module and expect it to work. 
    You have sold the job of a programmer and Outlook developer with no skills in that area.  Is that fair to your customer?
    There are hundreds of skilled developers who have spent good money and time learning to do these things. You cannot just past some things you found on the Internet into a file and ask someone to fix it for you. 
    Start by learning the difference between script and VB.  Next you need to learn what an event is and how it is generated.  The code you posted does nothing in Outlook because it is not Outlook code.
    No.  I am not picking on you.  I am trying to get you to wake up and spend time learning your profession.  It is a lot of fun and actually pretty easy but only if you do your homework.
    ¯\_(ツ)_/¯

  • How to increase the number of rows for Entry via Excel in SSM ?

    hello
    we are facing a scenario where we need to enter the target data for more than 14000 fields.So when we open the excel ad in and trying to upload, it is accepting data for only 500 fields and the rest are not getting displayed.
    The condition is that we have to enter data via Entry and Approval and not using a procedure and multiple metric sets is not a feasible option since the number of records is large. How can the number of rows in excel be increased ?
    Vijay

    Hi Bob
    I am facing another problem....
    we have designed our model in such a way that we built it using normal procedures but the target values have to be entered using entry and Approval via Excel ad-in..
    the problem we are facing is that if we select both the actual and the target measures to load the data via Excel login then the column TARGET is getting greyed out. When we build the same model using cube builder , the column TARGET is not getting greyed out and we are able to enter data there.
    Is there any setting changes we need to make inorder to make the Entry and Approval process via Excel behave the same way when the model is built using the Cube builder ? Are there any new notes or a newer version of Excel ad in to resolve this ?
    Vijay

  • Call RFC Listener via Excel

    Hi all
    Is it possible to call the Message-Listener (RFC) via Excel (VisualBasic) or do i have to use a WebService to send data from Excel to MII?
    Thanks in advance!
    Daniel

    You can send data from excel to the MII message listener with a simple http post.
    Message format requirments can be found here:
    [http://help.sap.com/saphelp_xmii120/helpdata/en/45/6a86ac88130dece10000000a11466f/content.htm|http://help.sap.com/saphelp_xmii120/helpdata/en/45/6a86ac88130dece10000000a11466f/content.htm]
    Edited by: Christian Libich on Aug 10, 2009 10:14 PM

  • Send An Internal Table Via Excel File As An Attachment of E-mail

    Hi,
    I've sent my internal table via Excel file as an attachment of email but all records of internal table are in a row of sended excel file.
    How can i send an internal table via excel file , records of internal table for each rows of excel file,as an attachment of email correctly?
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list     "   t_packing_list-doc_type   =  'XLS'.
                contents_bin               = pit_attach " this is a normal internal table.
                contents_txt               = pit_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.

    Hi,
    CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
    CONSTANTS:
    CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
    CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
          LOOP AT T_FINAL INTO WA_T_FINAL.
            CONCATENATE WA_T_FINAL-PERNR
                        WA_T_FINAL-NAME
                        WA_T_FINAL-LEVEL
                        WA_T_FINAL-POS
                        WA_T_FINAL-JOB
                        WA_T_FINAL-SECTION
                        WA_T_FINAL-DEPT
                        WA_T_FINAL-GROUP
                        WA_T_FINAL-EX_HEAD
                        WA_T_FINAL-SUPID
                        WA_T_FINAL-SUPNM
                        WA_T_FINAL-FHRNM
                        WA_T_FINAL-VACID
                        WA_T_FINAL-VAC_SECTION
                        WA_T_FINAL-VAC_DEPT
                        WA_T_FINAL-VAC_GROUP
                        WA_T_FINAL-VAC_EX_HEAD
                        WA_T_FINAL-VAC_FHRNM
            INTO T_FINAL3 SEPARATED BY CON_TAB.
            CONCATENATE CON_CRET T_FINAL3 INTO T_FINAL3.
            APPEND T_FINAL3.
          ENDLOOP.
    *Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    *Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME = 'REPORT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE . "mail description
      W_DOC_DATA-SENSITIVTY = 'F'.
    *Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      READ TABLE T_FINAL1 INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
      ( W_CNT - 1 ) * 255 + STRLEN( T_FINAL1 ).
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PT_FINAL1[].
    *Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'RAW'.
      APPEND T_PACKING_LIST.
    *Create 1st attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR = 'Application 1'.
      T_PACKING_LIST-OBJ_NAME = 'Application 1'.
      T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
      CLEAR T_PACKING_LIST.
    *Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      T_RECEIVERS-RECEIVER = LD_EMAIL.
      T_RECEIVERS-REC_TYPE = 'U'.
      T_RECEIVERS-COM_TYPE = 'INT'.
      T_RECEIVERS-NOTIF_DEL = 'X'.
      T_RECEIVERS-NOTIF_NDEL = 'X'.
      APPEND T_RECEIVERS.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = W_DOC_DATA
          PUT_IN_OUTBOX              = 'X'
          SENDER_ADDRESS             = LD_SENDER_ADDRESS
          SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = W_SENT_ALL
        TABLES
          PACKING_LIST               = T_PACKING_LIST
          CONTENTS_BIN               = T_ATTACHMENT
          CONTENTS_TXT               = IT_MESSAGE
          RECEIVERS                  = T_RECEIVERS
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          DOCUMENT_TYPE_NOT_EXIST    = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR            = 5
          X_ERROR                    = 6
          ENQUEUE_ERROR              = 7
          OTHERS                     = 8.
    Edited by: Rahul Ghosh on Apr 6, 2009 6:42 AM

  • VBA script for custom Outlook 2010 calendar "first day of week"

    I need Outlook 2010 to use "week starting with the Saturday before Jan 1" as "first week of year" to match our company payroll calendar. (For example, Saturday 12/26/2015-Sunday 1/3/2016 would be "first week of 2016".) Is there
    a way to do this in a VBA script?
    -Thanks, zogg

    Hello zogg,
    The settings are stored in the registry at
    HKCU\Software\Microsoft\Office\15.0\Outlook\Options\Calendar
    where 15.0 stands for Outlook
    2013.
    Make changes in
    the Outlook settings and see which registry values change and in what way depending
    on the settings you change. 
    Also take a look at the How
    can I get the work week and day number in VBA (outlook 2010)? page which states the following:
    WW = Format(Now, "ww") & "." & Weekday(Now, vbMonday)
    The "Format" function returns an expression from a string formatted with the provided "format" argument (ww in
    this case, which returns the week of the year) and the Weekday() function
    returns the numbered day of the week where the first day is a VBDayOfWeek enumeration
    provided as the second argument (vbMonday in
    this case).

  • Trying to access the java script files via jar file in WEB SERVER

    hi all,
    I am trying to access the java script files via jar file ,which is present in Apache webserver in order to minimise the number of hits to app server.some thing like cache ...
    in jsp the code goes like this...
         <script type="text/javascript"  archive="http://localhost:14000/dojo.jar!" src="dojo.jar/parser.js" " ></script>{code}
    But i am not able to access the js file which is put in jar file present in the  webserver.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi,
    You can use DWR (Direct Web remoting) for that. It is easy AJAX for java. ou can directly call the java script function from java class and also java class from javaScripts..
    Regards,
    Hardik

  • How can get Information of Exfect in Illustrator by Script?

    Illustrator can setting Effect: Illustrator Effect, Photoshop Effect to Object,
    But i find in document not exist attributes can get their information.
    How can get Information of Exfect in Illustrator by Script?

     

Maybe you are looking for

  • Problem in ALV Top of Page

    Hi All, I am having a ALV report .Once i execute the report there will be ALV output once i click on the Material no((Hot spot)) in the output it ll take to the another ALV report.The problem is how to get the top of page in the second alv...The top

  • No time display on DVD player

    I have never had this problem in three y ears and I am so far stumped. Read the manual, looked in this forum, overlooked all my preferences and triple checked my project settings. here is the issue I see no time display or chapter display on my DVD p

  • Where is the Apps 11i adpater software for Solaris ?

    Hi, I installed interconnect 10g on Solaris for testing. In the CD, I can install the adapters for MQ, DQ, AQ, SMTP and some others. But, I can't finf any trace of the software adapter for the Apps 11i ? Someone can help me to find it for Solaris ? T

  • How do i get my apps from my iphone 4 to upload to my new iphone 5

    I just bought a new iphone 5.  I am trying to bring all my apps from my iphone 4 to my new phone.  Not sure how to do that.  Any advice?

  • Use Muse Forms with out Business catalyst

    Hello, I just finished a site on Muse. Skybalancecenter.com. I used one of the easy to use contact forms but it says it is configured to work only with Business Catalyst. i have my own hosting account with Godaddy where the site is on. how can I mani