Microsoft Excel VB Macro Help!

Hi all,
I am currently working on a basic Stock Control sheet where the current stock is on one sheet and then there is another sheet for re-ordering stock. What I need to happen is when I click a button at the end of the row it copies certain cells from this sheet
over to the next available row on the other sheet whilst also taking the value down in cell M8 by 1 (I haven't added this bit in yet but need help in doing so please!)
My Code is below for what I have but it keeps adding it into row 8 on the re-order sheet instead of adding it in the next available row if row 8 is already in use? Can someone help please?!?
Sub NewOrderRow8()
' NewOrderRow8 Macro
response = MsgBox("Are You Sure You Want To Add This To The Order List?", vbYesNo)
If response = vbNo Then
' MsgBox ("Macro Ending")
Exit Sub
End If
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Inventory Control")
Set pasteSheet = Worksheets("Re-Order Sheet")
copySheet.Range("B8:D8,G8:I8").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 2).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Many Thanks!
Daniel

Re: paste into wrong row
You are pasting into column(3) but checking for the last row in column(1).
Change Offset(1,  2) to...
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Jim Cone
Portland, Oregon USA
free & commercial excel programs
https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2

Similar Messages

  • Microsoft Excel reports me what xls file is not Excel format. Is there any way to fix this problem?

    How to repair xls file? Microsoft Excel reports me what file is not Excel format.

    To repair xls file you may tre demo version of Excel Repair Toolbox , but sometimes recovery
    function in Microsoft Excel are not helpful so in that cases you can use third-part tool for recovery bad tables. Install it from here: http://www.excel.repairtoolbox.com/

  • I upgraded to mountain lion a week ago and now on startup of my macbook pro, microsoft excel and word start up automatically and then crash? very strange can anyone please help? I have checked the login items under users and groups and there is nothing.

    I upgraded to mountain lion a week ago and now on startup of my macbook pro, microsoft excel and word start up automatically and then crash? very strange can anyone please help? I have checked the login items under users and groups and there is nothing.

    Are you using the Office for Mac 2011 version, as you need to do?  The Office for Mac 2004 is Not at all compatible with Mountain Lion, and the 2008 version has been noted to have some problems running with ML.
    Hope this helps

  • Microsoft Excel counting help

    Good morning community,I need some help with Microsoft Excel 2013. I took a screenshot to help explain what I'm trying to accomplish. Column L represents the amount of times the 'defect code' for Column M appeared. In Column M, I want to take a count of how many times each number (Defect Code) appears. Then I want to add that value to the number in Column L associated with it. For example, '335' appears 3 times in Column M so that total is 3. In the first row, 1 is next to 335 in Column L. The second time it appears 3 is next to it, and the third is 1. Therefore, 5 is the total sum of how many times 335 appeared. Then you add those two numbers together so the total would be 3+5=8.If you were able to understand my incoherent explanation, is there anyway to get this 'total count' that I'm looking for? I was looking at pivot tables and...
    This topic first appeared in the Spiceworks Community

    Re: paste into wrong row
    You are pasting into column(3) but checking for the last row in column(1).
    Change Offset(1,  2) to...
    pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
    Jim Cone
    Portland, Oregon USA
    free & commercial excel programs
    https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2

  • Excel 2013 macro to save pptx as pdf; error in code?

    Hello MSDN community,
    I know that this question probably was asked x1000 times, but i've been struggling for the past 6 hours to covert pptx to pdf via excel vba (this is required for my report generator, and in order to keep layout clean ad tidy i've decided to use PowerPoint,
    because Word constantly mess things up).
    Here's the code im using:
    Dim ppt As Object
    On Error Resume Next
    Set ppt = GetObject(, "PowerPoint.Application")
    If ppt Is Nothing Then
    Set ppt = CreateObject("PowerPoint.Application")
    End If
    On Error GoTo 0
    Set WDReport = ppt.Presentations.Open("C:\Users\User1\Documents\Folder\Final Report Template.pptx")
    WDReport.UpdateLinks
    Dim FileName2 As String
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\" & Sheet14.Range("Q3").Text & " No " & Sheet14.Range("U21").Text & " Report" & Sheet17.Range("E10").Text & ".pdf"
    WDReport.ExportAsFixedFormat FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen
    WDReport.Close
    ppt.Quit
    Set ppt = Nothing
    Set WDReport = Nothing
    But right after PPT file opens and updates links, i receive an error message "13 Type Mismatch" on the line WDReport.ExportAsFixedFormat
    FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen. I've tried to replace WDReport with ActivePresentation, but received and error "429 ActiveX Component Cant Create Object".
    Here's the list of Libraries activated:
    Visual Basic for Applications
    Microsoft Excel 15.0 Object Library
    Microsoft Word 15.0 Object Library
    Microsoft PowerPoint 15.0 Object Library
    OLE Automation
    Microsoft Office 15.0 Object Library
    Additional info:
    1. When initially i was converting .docx to pdf via excel vba, everything worked out fine (well except for the format, ofcourse).
    2. I've tried to change
    FileName2 to FileName2
    = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf", but without any success.
    3. Ranges used in FileName2 use the following variable data:
    Range("Q3") is Name (e.g. Test Company)
    Range("U21") is Number (e.g. 1234567891011)
    Range("E10") is Date (e.g. Feb-15)
    So the final file name would be like "Test Company No 1234567891011 Report Feb-15.pdf".
    Once again, it worked fine when i was converting .docx to pdf 
    4. I've run this part of macro directly from PowerPoint, and it worked out fine.
    Dim FileName2 As String
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf"
    ActivePresentation.ExportAsFixedFormat FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen, msoFalse
    So i guess there might be a problem with my Excel-PowerPoint commands execution?
    I'd really appreciate if anyone could help me with this issue. Thanks in advance!

    Hello MSDN community,
    I know that this question probably was asked x1000 times, but i've been struggling for the past 6 hours to covert pptx to pdf via excel vba (this is required for my report generator, and in order to keep layout clean ad tidy i've decided to use PowerPoint,
    because Word constantly mess things up).
    Here's the code im using:
    Dim ppt As Object
    On Error Resume Next
    Set ppt = GetObject(, "PowerPoint.Application")
    If ppt Is Nothing Then
    Set ppt = CreateObject("PowerPoint.Application")
    End If
    On Error GoTo 0
    Set WDReport = ppt.Presentations.Open("C:\Users\User1\Documents\Folder\Final Report Template.pptx")
    WDReport.UpdateLinks
    Dim FileName2 As String
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\" & Sheet14.Range("Q3").Text & " No " & Sheet14.Range("U21").Text & " Report" & Sheet17.Range("E10").Text & ".pdf"
    WDReport.ExportAsFixedFormat FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen
    WDReport.Close
    ppt.Quit
    Set ppt = Nothing
    Set WDReport = Nothing
    But right after PPT files opens and updates links, i receive an error message "13 Type Mismatch" on the line WDReport.ExportAsFixedFormat
    FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen. I've tried to replace WDReport with ActivePresentation, but received and error "429 ActiveX Component Cant Create Object".
    Here's the list of Libraries activated:
    Visual Basic for Applications
    Microsoft Excel 15.0 Object Library
    Microsoft Word 15.0 Object Library
    Microsoft PowerPoint 15.0 Object Library
    OLE Automation
    Microsoft Office 15.0 Object Library
    Additional info:
    1. When initially i was converting .docx to pdf via excel vba, everything worked out fine (well except for the format, ofcourse).
    2. I've tried to change
    FileName2 to FileName2
    = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf", but without any success.
    3. I've run this part of macro directly from PowerPoint, and it worked out fine
    Dim FileName2 As String
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf"
    ActivePresentation.ExportAsFixedFormat FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen, msoFalse
    So i guess there might be a problem with my Excel-PowerPoint commands execution?
    I'd really appreciate if anyone could help me with this issue. Thanks in advance!
    This undoubtedly has to do with the  FileName2 string, something must be incorrect with concatenation. As a test, in the VBA sub in Excel have the following
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf"
    , I bet you the code would work :)

  • Microsoft Excel cannot access the file "-". There are several possible reasons. Windows Server 2008 R2 with Microsoft Office 2010

    I have a problem with starting the Excel Application under a particular user (service account).
    I try to schedule this C# script through an application X (not Windows Task Scheduler. And this
    application will always use a service account to run services on the server). If I run the C# script in
    command prompt under the same user, it runs. Under the application X, which uses the exact same
    user, to initiate the C# script, it fails to open the Excel application (not sufficient permission?).
    This script calls application.Workbooks.Open(<ExcelFileName>,0,false,Type.missing....). At this line
    of code, it gives the following error:
    Microsoft Excel cannot access the file "...". There are several possible reasons:
    -The file name or path does not exist.
    -The file is being used by another program.
    -The workbook you are trying to save has the same name as a currently open workbook.
    I tried all the methods that I found online as follow:
    Create directory "C:\Windows\SysWOW64\config\systemprofile\Desktop" (for 64 bit Windows) or "C:\Windows\System32\config\systemprofile\Desktop" (for 32 bit Windows).
    Changed the DCOM config for the Microsoft Excel application to include this user for Local/Remote Launch and Access.
    Enabled all macros in Excel application and set the Trust Center.
    Add the user to have full control on all folders that contain the Excel file.
    Under DCOM
    config, Microsoft Excel Application, if I modify the Identity tab to check on "This User" and enter the username/password to let Excel always run under that user. Then the application runs perfectly. However, other users can't run the excel application
    on their own with the following error: "Cannot use object linking and embedding". If I check "Use the launching user", then Excel can't be launched. No errors in the logs or events anywhere to check.
    Yet, still the same error. I think it's permission but I am not sure where and what to do for this to work.
    Now, normally, when I run this excel report, I can double-click on the file and it'd automatically run,
    save the new parameters into the current file and generate a new excel file (with date attached to the
    file name). That means there is a change (save) to the original file.
    Environment: Windows Server 2008 R2 and running Microsoft Excel 2010.
    I appreciate all your help!

    I am wondering if this has anything to do with having the user log into Excel.
    In point #5 above: Under DCOM config, Microsoft Excel Application, if I modify the Identity tab to check on "This User" and enter the username/password to let Excel always run under that user. Then the application runs perfectly. However, other
    users can't run the excel application on their own with the following error: "Cannot use object linking and embedding". If I check "Use the launching user", then Excel can't be launched. No errors in the logs or events anywhere to check.
    Because running with the launching user proposes an user to run the Excel application. However, I do not think there is any where that we can pass in the password for this user to Excel. However, this Excel has all the permissions to Excel application as
    well as the folders that have the Excel files.
    Please help!
    Thank you!

  • Security settings in Microsoft Excel

    Hi all,
    Iam using presently SAP 2007B PL08 and MSExcel2003.When i was trying to generate aa report (XL report) getting an error.Error as follows "a required COM add-in program for XL reporter has not been loaded & prohibits MS Excel from running".Help regarding this

    (Excel 2007)
    Go to excel
    Office button -> Excel Options button
    Add-Ins
    Manager: COM Add-ins -> Go
    SAP Business One XL Reporter should be selected.
    +Disabled Items
    (Excel 2007)
    Go to excel
    Office button -> Excel Options button
    Add-Ins
    Manager: Disabled Items -> Go
    SAP Business One XL Reporter should not be listed.
    If it is please select it and click Enable button.
    +Macro Visual Basic Project
    (Excel 2007)
    Go to excel
    Office button -> Excel Options button
    Trust Center -> Trust Center Settings...
    Macro Settings -> Trust access to the VBA project object model
    Solution from SAP note:
    You need to be an administrator on the local machine to add COM add-ins.
    1. Start Microsoft Excel. If you already have the COM Add-ins command on the Tools menu, go to step 7.
    2. In the Tools menu, choose Customize. This opens the Customize window.
    3. Choose the Commands tab and select Tools from the Categories pane on the left.
    4. In the Command pane on the right, scroll down to the COM Add-ins command.
    5. Select the COM Add-ins command, hold down the mouse button, and drag COM Add-ins from the Commands pane over to the Tools menu on the Microsoft Excel men bar. When the Tools menu commands appear, point to where you want the COM Add-ins command to appear on the menu and release the mouse button.
    6. To close the Customize window, choose Close.
    7. On the Tools menu, choose the new COM Add-ins option. This opens the COM Add-ins window.
    8. In the window, choose Add to open the Add Add-in window.
    9.Select the IXXLReporter.dll file located in the Client directory in the XL Reporter program installation area and choose OK.
    10. In the COM Add-ins window, select the XL Reporter checkbox and choose OK.

  • Excel and Macro with Labview

    Hello every body,
    I have to read to excels files int order to treat them and generate graphs ( 3 graphes) in another excel file. to do that, i want to use the Macro for Excel.
    How can i do, I want to write my basics codes VBA even in Labview.
    Tks for your help

    It also requires the Office Report Generation Toolkit.....
    So maybe i shorten this and tell you that the toolkit includes a VI called "Excel Run Macro.vi". Within this VI, an ActiveX call is done to the Excel Application class called "Run" taking many optional arguments.
    So working with ActiveX to interface with Excel will give you the needed toolsuite.
    Please refer to msdn.microsoft.com for specific help on Microsoft products (like Excel). You can use this link for an easier start.
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Ecurity settings in Microsoft Excel

    Hi all,
      Iam using presently SAP 2007B PL08 and MSExcel2003.When i was trying to generate aa report (XL report) getting an error.Error as follows "Security settings in Microsoft Excel prohibit Xl reporter from running".For this please help me

    Hi,
    In addition to the MS Excel Macro->security,In  the Security window,
    Choose the Trusted Sources tab and make sure the Trust all installed add-ins and templates and Trust access to Visual Basic Project checkboxes are selected.
    If you are running Microsoft Office 2000 on your computer, you can only select the checkbox; Trust all installed add-ins and templates.
    If problem still appears then
    Install Visual Basic for Applications in Office(For Office 2003).
    In Windows, go to Start -> Control Panel -> Add/Remove programs. Find Microsoft Office 2003, select it and choose Change.
    In the Office 2003 setup window, choose Add or Remove features and choose Next.
    Check the box "Choose advanced customization of applications" and choose Next.
    Expand the line "Office Shared Features", scroll down and choose the dropdownbox for Visual Basic for Applications and choose Run from My Computer.
    Choose Update and wait for the installation to finish. Choose OK when a message saying that Office 2003 has been updated successfully appears.
    Now you should be able to run or edit reports in Excel.

  • SAP Advanced Planning and Optimization, Demand Planning Add-In for Microsoft Excel 1.0

    Does anyone know if the DP Add-in for Microsoft Excel is doing well. How does it pull/push data on the DP tool? Is it fast, and is it a free add-in ?

    Hi Satish
    As you know business always loves to work in excel and if we offer this possibility they are going to appreciate it very much.
    We have already perform PoC for the excel frontend in out business scenario and looks really positive. At the same time, I will also say that there is still big room for improvement for SAP. SAP is already coming with better excel front end but only with IBM demand solution.
    so going back to our topic, I would say surely you should go for it. It would be really great if you have data view with less or minimum key figures should be exported to excel where business require to update or maintain key figures. If I am correct, I think you are unable to use it for aggregate forecasting or you have default macro´s to be execute immediately.
    In summary, it´s worth to explore the option to see if it works for your business. I am sure business users will be very much happy with this.
    Please let me know if this information helps you.
    Thanks
    Amol

  • Using AppleScript to Launch Excel VBA Macro

    Using MS Office 2004 and AppleScript 1.9.3. I want to use AppleScript in MS Entourage to kick off a VBA macro in Excel. But no luck.
    To test things, I created an Excel file ("test.xls") with a one-line VBA macro named "test." It just puts up a dialog box with the message "success." I'm calling it from A.S as follows (per the AppleScript Dictionary for Excel 2004):
    tell application "Microsoft Excel"
    run VB macro "hard disk:users:xxx:desktop:test.xls!test"
    end tell
    I get two successive error messages:
    1. 'test.xls' cannot be accessed. The file may be read-only or you may be trying to access a read-only location."
    2. "Microsoft Excel got an error: "hard disk:users:xxx:desktop:test.xls!test" doesn't understand the run VB macro message."
    "test" file permissions are -rw-r--r-- and it is sitting right on the desktop.
    FWIW, I did not remove the old Office vX yet, but renamed old Excel "Microsoft ExcelOld". I read on some other site that this may cause problems.
    This has been endlessly frustrating. HELP!!??
    Steve

    Hi Steve,
    Have you tried dealing with the return value from your macro? If you are invoking the MsgBox function in your test macro, you may need to allow the return value from MsgBox to pass thru back to AS. Something like :
    set MyRetCode to run VB macro "Macintosh HD:Users:xxx:Desktop:test.xls!test"
    (Note unless you've changed the hard drive name to "hard drive", the default boot drive name will probably be "Macintosh HD". Case does matter here)
    I also suspect you'll need to have Entourage up as well in the full case of running a macro in Entourage from Excel (or the other way around). Hence, the command ActivateMicrosoftApp in the Excel dictionary may also be useful.
    Second, you can have a macro, in a startup template, in Entourage call a macro in a startup template in Excel to accomplish what you want without going into AppleScript at all. This latter, VB-only, method will require a "Reference", as it's called in VBA, to be added to the TemplateProject in Entourage that points to the Excel macro you want to fire off. The added benefit of this latter method is that you will have access to the full range of VBA commands/options, rather than the smaller dictionary available in AS.
    Ed
    PB G4   Mac OS X (10.2.x)  

  • Microsoft excel error while exporting a FRS report from Planning to excel

    I have multiple screen shots of the issue.
    are getting issues when within citrix trying to run an FRS report from workspace into excel.
    first they get a windows login window looking for credentials of a User name and a Password.
    the first error:
    "Could not open 'http:SERVERNAME:19000/hr/hrget/modules/com/hyperion/reporting/web/office/HROfficeReport.jsp/FOLDERNAMEandFILENAME.xls?format=excel.20028viewAs=excel&instanceId=11165278&previewDone=true'.
    second error:
    Microsoft Excel cannot access the file 'http:SERVERNAME:19000/hr/hrget/modules/com/hyperion/reporting/web/office/HROfficeReport.jsp/FOLDERNAMEandFILENAME.xls?format=excel.20028viewAs=excel&instanceId=11165278&previewDone=true'. There are several possible reasons:
    The file name or path does not exist.
    The file is being used by another person
    The workbook you are trying to save has the same name as a currently open workbook.
    Third error:
    The file you are trying to open, 'FILENAME.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file do you want to open the file now?
    yes , no, or help
    I am trying to figure out if its a CITRIX issue? An EPM issue? or what
    We have Office 2010 32 bit with smart view and excel add-in.
    Does anybody know why this may occur? I have screen shots I just don't know how to post them.

    When you export a FR report to excel, yes, you will get a prompt for credentials, but as said in 11.1.2 HFR guide, you have to ignore that by clicking "Cancel" and then you will get a second warning pop-up saying "The file you are trying to open, 'FILENAME.xls', is in a different format ........"... Click on "Yes"... you should be able to see the report in excel....
    Both these are known issues in HFR export to excel and you can find them in oracle features guide. And they are not related to Citrix.
    As in Oracle HFR user guide "When exporting a Financial Reporting document to a Microsoft Office format (Excel, Word or PowerPoint), when using Microsoft Office 2007, you may receive the following warning: "The file your are trying to open <filename>, is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?". This warning notifies users that, although the file has an Office extension ( ".xls", ".doc" or ".ppt"), the content of the file is different from the expected (native) Office format. Although Financial Reporting reports are generated in an MHTML format during export, this is not a security concern. Microsoft Office is just warning a user of a file format that is different than expected. Upon selecting “Yes” in the warning, the file will successfully open in Microsoft Office."
    Thanks,
    Siva

  • Importing metadata from Microsoft Excel or Access to Adobe Bridge CC metadata

    I'm trying to figure out how to batch import a substantial amount of metadata in Microsoft Excel or Access to the IPTC core fields in Adobe Bridge CC. I've seen the issue discussed, but many of the posts about it are six or seven years old. So here are the simplest statement of the questions:
    1. Is it possible to export data from Excel or Access to XMP and then batch-import it in Adobe Bridge CC?
    2. If it requires templates, are there commercial, shareware, or freeware templates that will achieve this?
    3. If so, what are the links to those repositories?
    4. Is there a set of step-by-step instructions to achieve this on PC and/or Mac?
    5. What are the links to those instructions?
    Thanks in advance for your help. I've used Bridge from CS1... but I've never used it for batch-importing to IPTC.

    Well,
    it works for me without problems.
    Some information on my setup and what I did:
    - my primary browser language is English (en-us)
    1) Save the data in a file called hardware.txt:
    SERIAL,HOSTNAME,ITEM_TYPE,BRAND,MODEL,OWNER,STATUS
    AEP016136,d2vmrw61,Laptop,Dell,m71,Gary Cleary,Active
    AEP016169,dhj3b71,Desktop,Dell,Dimension 4700,Unassigned,Active
    AEP016170,cn-0g8432-64180-52p-1yts,Monitor,Dell,E193FP,Unassigned,Active2) Load the data (Load text data) into an existing table by uploading a file:
    - File: hardware.txt
    - Separator: , (comma)
    Worked fine.
    3) Load the data (copy /paste spreadsheet data into an existing table):
    - Open the file hardware.txt in Excel and import it into the spreadsheet
    - copy all three lines and paste them into the textarea in XE (the difference is that the columns are no longer separated by commas but by tabs)
    Worked fine as well.
    Please try the above mentioned steps and see whether you still get the error.
    ~Dietmar.

  • Not displaying the data in the ALV Microsoft Excel (Ctrl+Shift+F7)..

    Hi All,
    I can able to display the data through the FM REUSE_ALV_GRID_DISPLAY in the out put screen.When I click on the Microsoft Excel (CtrlShiftF7) at the ALV toolbar to view the same data in excel sheet it does open the excel sheet WITHOUT ANY DATA. Please help me how to make the data visible in the excel sheet.
    Can anyone help in this regard.
    Thanks & Regards,
    Seshadri G

    Hi,
    Check whether the tool bar export is disabled in the alv.
    check in the alv->set_table_for_first_display  FM the toolbar exclude export list.
    If that is ok, then try download manually by providing abutton and clicking it. You can download data manually in this way.
    refer the code below.
    DATA: lv_path      TYPE string,
            lv_fullpath  TYPE string,
            lc_c         TYPE string,
            v_fnam       TYPE string,
            lc_date(15)      TYPE c.
      TYPES: BEGIN OF ts_fieldnames,
                field_name(1000),
             END OF ts_fieldnames.
      lc_c =  'C:\'.
      WRITE sy-datum TO lc_date.
      DATA:lt_fieldnames TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames TYPE ts_fieldnames,
           lt_fieldnames1 TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames1 TYPE ts_fieldnames,
           lt_fieldnames2 TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames2 TYPE ts_fieldnames,
           lt_fieldnames3 TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames3 TYPE ts_fieldnames,
           lt_fieldnames5 TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames5 TYPE ts_fieldnames.
      CONCATENATE 'ContractAccount'
                  'DocumentNumber'
                  'Reference/InvoiceDocumentNumber'
                  'ClearingDocumentNumber'
                  INTO ls_fieldnames-field_name SEPARATED BY
                  cl_abap_char_utilities=>horizontal_tab.
      APPEND ls_fieldnames TO lt_fieldnames.
      CONCATENATE '' ''
                  INTO ls_fieldnames5-field_name SEPARATED BY
                  cl_abap_char_utilities=>newline.
      APPEND ls_fieldnames5 TO lt_fieldnames5.
      DATA :    ls_str1 TYPE string,
                ls_str2 TYPE string.
      ls_str1 = 'Invoice Clearing Posting'.
      ls_str2 = 'Payment On Account Posting'.
      CONCATENATE ls_str1  ' :: ' lc_date INTO ls_fieldnames2-field_name.
      APPEND ls_fieldnames2 TO lt_fieldnames2.
      CONCATENATE ls_str2 ' :: ' lc_date INTO ls_fieldnames3-field_name.
      APPEND ls_fieldnames3 TO lt_fieldnames3.
      CONCATENATE 'ContractAccount'
                  'Reference/InvoiceDocumentNumber'
                  'PostOnAccountDocumentNumber'
                  INTO ls_fieldnames1-field_name SEPARATED BY
                  cl_abap_char_utilities=>horizontal_tab.
      APPEND ls_fieldnames1 TO lt_fieldnames1.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title      = 'Select file for download'
          default_extension = '.xls'
          default_file_name = lv_path
          initial_directory = lc_c
        CHANGING
          filename          = lv_path
          path              = lc_c
          fullpath          = lv_fullpath
        EXCEPTIONS
          cntl_error        = 1
          error_no_gui      = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        v_fnam = lv_fullpath.
      ENDIF.
      IF v_fnam IS INITIAL.
        RETURN.
      ENDIF.
      IF i_finalclear[] IS NOT INITIAL.
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            filename              = v_fnam
            filetype              = 'DAT'
           HEADER                = header
            append                = 'X'
            write_field_separator = 'X'
          CHANGING
            data_tab              = lt_fieldnames2
          EXCEPTIONS
            OTHERS                = 8.
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            filename              = v_fnam
            filetype              = 'DAT'
           HEADER                = header
            append                = 'X'
            write_field_separator = 'X'
          CHANGING
            data_tab              = lt_fieldnames
          EXCEPTIONS
            OTHERS                = 8.
    REgards
    sheron

  • The goal is to synchronize an excel sheet using Microsoft Excel 2010 with Sharepoint 3.0

    The goal is to synchronize an excel sheet using Microsoft Excel 2010 with Sharepoint 3.0. We have already installed an add-in (Excel 2007 Add-in: Synchronizing Tables with SharePoint Lists) that was supposed
    to help the synchronization of excel to Sharepoint, but it did not work. We would like to synchronize information about a calendar from excel to Sharepoint 3.0, so every time a change is made in excel it automatically updates in Sharepoint.

    ootb, changes in excel don't sync with a SharePoint list, the other way around is possible.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

Maybe you are looking for

  • IPod Touch 4g stuck in recovery mode and lock button broken

    A few days ago my lock button stopped functioning, and seeing as I'm not brave enough to try and fix it myself and I haven't been able to take it to get fixed anywhere yet, I just enabled the internal lock button feature and, frankly, hoped for the b

  • Lost 3rd Party Apps After iOS 5.1.1 Update.

    I updated my wife's iPhone 3GS from iOS 3.something to iOS V5.1.1. This device had never been connected to the computer I used. I download iTunes, authorized the iPhone, downloaded iOS, did a backup (by right clicking on Device). I think most, if not

  • How to schedule a Process Chain using ABAP Program?

    Hi All, I want to schedule the activity of extracting data from the query to a flatfile. Currently we are schedulling it using the transaction rscrm_bapi. I need to know , how we can achieve the same using an abap program and not ( rscrm_bapi) in a p

  • Need to limit amount of visible characters in a field

    I have a page that displays a list of projects. One of the fields is a description field and I'm trying to figure out how to have the description field display only about 200 characters instead of the whole description. Ideally, I'd like to have a li

  • IPad photos sort by size, largest disk size to smallest?

    iPad photos sort by size, largest disk size to smallest?