VBA Macro code to refresh query

Hi people,
First post...
I am running BI7.1 and have set up a workbook with various queries that have to be run on separate days.
I have a cover page that I have set up and want to have buttons on this page that when clicked will only refresh the relevant query for that specific day.
I have searched online in various places and have only found the VBA code to do this using the old BEx Analyser (3.5)
Is there a way or code available to enable me to automaticallt refresh a query using a macro?
Thanks
Steve

Hi,
I have tried to do this on numerous occasions, and no matter what I do the macro recorder does not pick up any of the refresh activities.
The VBA code I have used in the past is "Run "SAPBEX.XLA!SAPBEXrefresh", False"
This worked when I used to use Analyzer 3.5 however it doesn't work in the current version.
I am looking for a similar piece of code that will allow me to add to existing macro which will trigger the refresh of the query.
Any help is much appreciated
Thanks
Steve

Similar Messages

  • Copying Graphs and Pie Charts generated in Analysis View to Email item using Excel VBA Macro Code

    Hi
    I am currently working on an exce VBA macro code that would help me take snapshots of the Graphs and Pie charts generated in QC for a particular application and copy the same to an email item using excel VBA macro code.
    I was able to write the code to create an email item. But I have no clue of how i can take snapshot of the graphs in Analysis View using excel VBA
    Any help would be highly appreciated.
    Thanks in Advance
    Regards
    Amit

    useramit,
    You are in the consumer end products forum.  You will also want to ask your question over at the Enterprise Business Community.
    Click the plus sign (+) next to Discussion Boards to drop down all the options for servers, networking and any other professionally related problems.
    http://h30499.www3.hp.com/

  • Oracle BI Add-In for Excel - Need VBA Macro Command to Refresh Data

    I am trying to find the VBA command that i can use within my Excel Macro to refresh the data from my BI Connector

    Oracle XML Publisher Desktop 11.1.5
    also work for Excel

  • VBA Macros Running Before BPC Routine is Done

    Hello, All -
    Working on converting our BPC 7.5 templates to version 10 and I'm having an issue with our custom VBA macro codes.
    In our 7.5 system, all our input templates call custom VBA macro routines when certain SAP functions are done executing (i.e.: once a Refresh is done, execute this macro code).  In 7.5, we have macro codes within the BEFORE_REFRESH, AFTER_REFRESH, BEFORE_EXPAND, and AFTER_EXPAND routines (note: our templates utilize the EvDRE function) and our custom macro codes would not run until the SAP function was done processing, which worked out perfectly however, it appears that something has changed in version 10 as all our macro codes are executing even though the SAP system is still processing in the background.  I confirmed this behavior by placing a macro stopper next to certain macro codes and noticed that VBA is already at that point of executing those codes yet in the background, I can still see the 'processing' box. In 7.5, the processing box is already gone before the custom macro code executed.  Not sure why the macros are executing when SAP is not done fully processing yet.
    Has anyone encountered this type of behavior where custom VBA code is running prematurely before SAP is done processing?
    In addition, it appears that SAP is no longer utilizing the Excel Status bar when certain processes are being executed. In 7.5, when a Refresh command was executed (for example), the status bar at the bottom of Excel would be updating (ready...retrieving data...calculating...formatting, etc...), which allowed us to check the Status bar for the word 'COMPLETED' as this was our indicator that SAP was done processing.  In version 10, it appears that SAP has done away with the use of the Status bar because I am no longer seeing any kind of message flowing through down there when certain SAP functions are running.  Correction: the only messages I see are 'Ready' and a brief moment of 'Calculate'.  Because nothing is appearing on the status bar, our custom macro codes are not working in the new version.
    Does anyone know if this feature no longer available in version 10?
    Other Information:
    + Office 2010
    + BPC v10 on Microsoft platform
    + EPM Server version: 10.0 SP16
    + EPM Add-in version: 10.0 SP21 .NET 3.5; Build: 9094
    Thanks,
    Carlo

    ADDENDUM:
    7 hours later.... to log in was "random", replies mostly not possible, two different error massages, the nice "looking for" and a generic "too many server access try later" (<<in German, my humble translation)
    there IS a lot of working going on, only explination...
    hope, we read some "Announcement"...
    it's late here, byebye, nitynite...

  • Running multiple refreshes using a VBA macro

    My company has just moved from BO 5.1.5 to BO XI 3.0 and I'm having some probelms running a VBA macro which extracts a large ammount of sales data to a text file. The macro uses an array and a For Each Next loop to enter variable details before the Refresh and then it downloads the text data, looping back to enter different Major Product values before the next refresh.
    Here is the code I'm using in BO 5.1.5 and would like to rewrite as event based code ie BeforeRefresh/AfterRefresh.
    Sub Main_Report()
        Dim Docs As Documents
        Dim Doc As Document
        Dim Rep As Report
        Dim Reps As Reports
        Dim DocNum As Integer
        Dim RepNum As Integer
        Dim Location As String
        Dim VarName As Variable
        Dim DataPro As DataProvider
        Dim FileName
        Dim Majors
        Dim MajorList
        Dim Period
        Dim Counter
        MajorList = Array("001", "002", "003")
        Period = Format(DateAdd("m", -1, Now), "YYYYMM")
        Counter = 0
    '   Enter user prompt values into query for current period and YTD
        For Each Majors In MajorList
        Counter = Counter + 1
            For i = 1 To ActiveDocument.Variables.Count
                Set VarName = ActiveDocument.Variables(i)
                If VarName.IsUserPrompt Then
                    Select Case VarName.Name
                        Case "Major Group"
                            ActiveDocument.Variables(i).Value = Majors
                        Case "Period"
                            ActiveDocument.Variables(i).Value = Period
                    End Select
                 End If
            Next i
        '   Refresh the current report and save data
            Application.Interactive = False
            ActiveDocument.Refresh
            Location = "
    seausdcff015\saracm$\My Documents\Tables\Sales\"
            Set Docs = Application.Documents
            Set Reps = ActiveDocument.Reports
        '   Export each report as "TXT" files from current document
            Set Doc = Docs.Item(1)
            FileName = Location & Doc.Name & "_" & Counter & ".txt"
            Set DataPro = ActiveDocument.DataProviders.Item(1)
            Call DataPro.ConvertTo(boExpAsciiTab, 1, FileName)
            Application.Interactive = True
        Next
    End Sub
    Can you please help. Cheers Milos.

    A coworker found this thread on asktom:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:861518416236107::::P11_QUESTION_ID:10498431232211
    It sort of details a similar (if not the same) method to that above.

  • Write VBA or cmd code to refresh essbase db from Planning app

    Dear all,
    Did somebody try to write code with VBA or cmd to refresh essbase db from Planning app?
    OS: Windows 2003
    Planning Version: 921
    Essbase EAS:921
    Any ideas to auto refresh essbase db from planning app?
    thx

    Hi
    There is a CubeRefresh.cmd utility that refreshes from Planning to Essbase. You will find it in the Planning > Bin directory (the location of which varies depending upon which version you are using). Take a look at the help doc below:
    [http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_hp_admin/frameset.htm?ch11s06s01.html]
    Hope this helps
    Stuart

  • Refreshing a VBA Macro Periodically

    Hi All
    I have assigned the below code that refreshes my data to a button. I was wondering if there was a piece of code that allows the data to automatically refresh/run every 20minutes???
    Sub RESFRESHCUSTOMERORDERS()
    ' RESFRESHCUSTOMERORDERS Macro
        ActiveSheet.Unprotect
        Sheets("KYPERA").Visible = True
        Sheets("KYPERA").Select
        Sheets("PIVOTS").Visible = True
        Sheets("KYPERA").Select
        Range("B7").Select
        Selection.ListObject.QueryTable.REFRESH BackgroundQuery:=False
        Range("F7").Select
        Selection.ListObject.QueryTable.REFRESH BackgroundQuery:=False
        Range("N7").Select
        Selection.ListObject.QueryTable.REFRESH BackgroundQuery:=False
        Range("BT7").Select
        Selection.ListObject.QueryTable.REFRESH BackgroundQuery:=False
        Range("BZ7").Select
        Selection.ListObject.QueryTable.REFRESH BackgroundQuery:=False
        Sheets("PIVOTS").Select
        Range("B5").Select
        ActiveSheet.PivotTables("PivotTable1").PivotCache.REFRESH
        Range("F5").Select
        ActiveSheet.PivotTables("PivotTable2").PivotCache.REFRESH
        Range("J5").Select
        ActiveSheet.PivotTables("PivotTable3").PivotCache.REFRESH
        Range("N5").Select
        ActiveSheet.PivotTables("PivotTable4").PivotCache.REFRESH
        Range("R5").Select
        ActiveSheet.PivotTables("PivotTable5").PivotCache.REFRESH
        Range("W5").Select
        ActiveSheet.PivotTables("PivotTable7").PivotCache.REFRESH
        Sheets("PIVOTS").Select
        ActiveWindow.SelectedSheets.Visible = False
        Sheets("KYPERA").Select
        ActiveWindow.SelectedSheets.Visible = False
        Sheet8.Select
        Range("G15").Select
        Selection.ListObject.QueryTable.REFRESH BackgroundQuery:=False
        ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
            , AllowFiltering:=True
    End Sub
    Thanks

    At the top of your module, declare a public variable:
       Dim NextTime As Date
    Then, at the and of your Sub, use
        NextTime = Now() + TimeValue("00:20:00")
        Application.OnTime NextTime, "RESFRESHCUSTOMERORDERS", Schedule:=True
    But you also need to use this in the before close event of the Thisworkbook codemodule:
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        CancelRefresh
    End Sub
    where you have this procedure in a standard codemodule to cancel the refresh:
    Sub CancelRefresh()
        Application.OnTime NextTime, "RESFRESHCUSTOMERORDERS", Schedule:=False
    End Sub

  • How Can I Schedule a Deski Report in Infoview that has a VBA Macro

    Hi experts,
    i've made a report that has a vba Macro. I published it in infoview. If I launch it manually (clicking on the refresh button) the macro works normaly. If I schedule it the macro doesn't work.
    What can I do?
    Is it possible to make a program that simulate the opening and click on the refresh button?
    Or i there is another solution?
    Here is my Macro:
    Private Sub Document_AfterRefresh()
    Dim filtervar As Variant
    Dim filterText, Filter As Long
    Dim DocName, NewName As String
    Dim Pathing, TodaysDate As String
    Dim folderName As String
    TodaysDate = Format(Date, "DDMMYYYY")
    Pathing = "
    Ktsdwh0\c$\OutputBO\"
    DocName = ThisDocument.Name
    filterText = "Dpre Cod Produttore"
    filtervar = ThisDocument.Evaluate("=<" & filterText & ">", boUniqueValues)
    For Each sepval In filtervar
        Filter = sepval
        For n = 1 To ThisDocument.Reports.Count
            Call ThisDocument.Reports(n).AddComplexFilter(filterText, "=<" & filterText & "> = " & Filter)
            ThisDocument.Reports(n).ForceCompute
        Next n
            MkDir (Pathing & Filter & "\")
            NewName = Pathing & Filter & "\" & Filter & "-" & TodaysDate & "-" & DocName   'for Prova_Prod.rep
    '        NewName = Pathing & Filter & "-" & TodaysDate & "-" & DocName   'for Prova_Prod.rep
            ThisDocument.ExportAsPDF (NewName)           'to Save as PDF
    Next
        For n = 1 To ThisDocument.Reports.Count
          Call ActiveReport.AddComplexFilter(filterText, "=<" & filterText & "> = <" & filterText & ">")
            ' To delete a Complex Filter, you set it equal to itself...
          ActiveReport.ForceCompute
        Next n
    End Sub
    Please Help!
    Best regards
    Camillo

    Hi Philippe,
    If you are using Windows 2003 with SP2 then it might be the issue as already logged for BOXIR2.
    You can test the issue by using only Windows 2003 without SP2.
    In case your operating system is only windows 2003 then following information and code might be helpful for you to resolve the issue.
    There are a number of things to check when setting up a macro to work through Infoview or scheduled. The first thing is that the macro needs to be triggered to run. This is done by putting a call to the macro in the Document_BeforeRefresh or the Document_AfterRefresh event handler.
    The report server and job server are designed to process one report at a time. Through a macro it is possible to open more than one report, and do various processing with those additional reports. Since the report and job servers are not designed to process more than one report, your macro should not open an additional report.
    The fact that only one report is processed at a time also affects the syntax you should use when referring to a document or report object. In the DeskI client you can use the ThisDocument object to refer to the report which is running the macro. You can also use the ActiveDocument object to refer to the report that is currently displayed. Most of the time these two objects will point to the same report. When the report server or job server process a report there would never be the possibility for a different report to be active, so the ActiveDocument object does not exist. This also applies to the ActiveReport object. Instead of using ActiveDocument your macro code should use the ThisDocument object. Instead of using the ActiveReport object you should use ThisDocument.Reports.Item(1) to refer to this first report tab in a report.
    These items are the most common issues that will cause a macro not to run through Infoview or when scheduled. The best way to debug a macro which is not working in either of those places is to include code which will log the macro's progress to a file. This makes it easy to determine exactly which line of code is causing issues so that it can potentially be corrected.
    #Region u201CWeb Form Designer Generated Code "
    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    End Sub
    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub
    #End Region
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim myInfoStore As InfoStore
    Dim myEnterpriseSession As EnterpriseSession
    myInfoStore = CType(Session("InfoStore"), InfoStore)
    myEnterpriseSession = CType(Session("EnterpriseSession"), EnterpriseSession)
    Dim DOCUMENT_NAME As String = "document_name"
    Dim query As String = "Select SI_ID, SI_NAME, SI_SUBJECT, " _
    & "SI_COMMENTS, SI_OWNER From CI_INFOOBJECTS Where SI_KIND = 'FullClient' " _
    & "AND SI_INSTANCE=0 AND SI_NAME='" + DOCUMENT_NAME + "'"
    Dim myInfoObjects As InfoObjects = myInfoStore.Query(query)
    Dim myInfoObject As InfoObject = myInfoObjects(1)
    Dim myDeskiDoc As FullClient = CType(myInfoObject, FullClient)
    Dim mySchedulingInfo As SchedulingInfo = myDeskiDoc.SchedulingInfo
    mySchedulingInfo.Type = CeScheduleType.ceScheduleTypeOnce
    mySchedulingInfo.RightNow = True
    Dim myFullClientFormatOptions As FullClientFormatOptions = myDeskiDoc.FullClientFormatOptions
    myFullClientFormatOptions.Format = BusinessObjects.Enterprise.Desktop.CeFullClientFormat.ceFullClientFormatFullClient
    myInfoStore.Schedule(myInfoObjects)
    End Sub
    End Class
    I hope this will help you.
    Regards,
    Sarbhjeet Kaur

  • Schedule a VBA macro based DeskI Report.

    Hi,
    We have a requirement to schedule a VBA macro based report via CMC and Infoview and I would like to acheive the below. Please help.
    1) To save the report output as CSV file after refresh in Xi R2 and I have the following code, which runs fine if I run manually, but if I schedule it in Xi R2, it does not run.Please help.
    Private Sub Document_AfterRefresh()
    Dim boDP As busobj.DataProvider
    Set boDP = ThisDocument.DataProviders.Item(1)
    OUTPUT_FILE_CSV = TARGET_FILE_DIR & OUTPUT_FILE_NAME & Format(Now, "YYYYMMDD") & "_" & Format(Now, "hhnnss") & ".csv"
    Call boDP.ConvertTo(5, 1, OUTPUT_FILE_CSV)
    End Sub
    The OUTPUT_FILE_CSV & TARGET_FILE_DIR are declared as global varilable. Please help.
    2) A prompt to be filled and the following syntax works fine when I run the macro manually. But does not work when I schedule in CMC (Variable prevented report to refersh error)..
    Private Sub Document_BeforeRefresh(Cancel As Boolean)
    newfromdate = DateAdd("M", -4, DateValue(Now))
    Application.Variables.Item("BOL Date").InterpretAs = boStringVariable
    Application.Variables.Item("BOL Date").Value = newfromdate
    End Sub
    Please advice.
    Thank You.

    Hi Sundaresan,
    Following are the important points related to scheduling deski report containing VBA macro:
    1. BusinessObjects XI Release 2 supports macros in
        Desktop Intelligence in InfoView, both when viewing or
        scheduling the document, but with caveats.
    2. There are slight differences in the execution flow when
        viewing a Deski in InfoView as opposed to viewing on
        the Desktop Intelligence client.
    3. A restriction on scheduling documents is that the
        scheduler can only open one document at a time u2013 so
        if you have macros that try and access another Deski
       document, it will fail.
    4. Whether a macro executes successfully or not would
        depend on the functionality used in the macro.
    May i know which service pack you are using,as this is known issue and it works fine with BOXI R2 SP2 and higher versions.
    I hope this helps you.
    Regards,
    Snehal

  • VBA macro for hiding a row

    Hi everyone,
    I have a question regarding VBA macros in BEx analyzer. I have few rows in which all values are zeros. I would like to hide such rows. I am trying to write a VBA macro to implement it. Could someone help me with this.
    Thanks
    R

    Hi Ram,
    I agree with Roberto that there is probably a way to do this entirely within BEx.  I would try a Condition.
    But ... here is what you've asked for.  Note that it is written assuming that there is more than one query in the workbook and that local Query ID for this query is SAPBEXq0001.  You might need to adjust these.
    This code would replace (or augment) what is currently in the Module named SAPBEX.
    Regards, Pete
    Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
    'code to hide any row where all Key Figures are zero
    Dim n As Integer, qRow As Integer, RowOffset As Integer
    Dim ColOffset As Integer, FirstRow As Integer, FirstCol As Integer
    Dim numCells As Integer, LastRow As Integer, LastCol As Integer
    Dim i As Integer, KFRange As Range, HideThisRow As Boolean
    Dim c As Range
        If queryID = "SAPBEXq0001" Then
            'locate this query's location in DIM table
            Set bexWS = Sheets("SAPBEXqueries")
            numQueries = bexWS.Range("A2")
            For n = 1 To numQueries
                If bexWS.Range("F" & n + 3) = queryID Then
                    qRow = n + 3
                    Exit For
                End If
            Next n
            'determine Key Figures offset
            RowOffset = bexWS.Range("G" & qRow)
            ColOffset = bexWS.Range("H" & qRow)
            'define first & last rows & columns for Key Figures
            FirstRow = resultArea.Rows(RowOffset).Row
            FirstCol = resultArea.Cells(ColOffset).Column
            numCells = resultArea.Cells.Count
            LastRow = resultArea.Cells(numCells).Row
            LastCol = resultArea.Cells(numCells).Column
            'search for and hide any row where all Key Figures are zero
            For i = FirstRow To LastRow
                Set KFRange = Range(Cells(i, FirstCol), Cells(i, LastCol))
                HideThisRow = True
                For Each c In KFRange.Cells
                    If IsNumeric(c.Value) Then
                        If c.Value <> 0 Then HideThisRow = False
                    End If
                Next c
                Rows(i).Hidden = HideThisRow
            Next i
        End If
    End Sub

  • In C# is there a way of refreshing query in EXCEL (REFRESH ALL)

    Hi All,
    Need C# code in SSIS Sript task which should refresh all excel data which extracts from a table using Microsoft query.
    Can anyone help at all ?
    Thanks 
    Sri.Tummala

    Hi All,
    Found the code to refresh excel data the above code is saving before refrshing so I added application wait for 20 seconds so that it refrshes first than saves it.
    Microsoft SQL Server Integration Services Script Task
    Write scripts using Microsoft Visual C# 2008.
    The ScriptMain is the entry point class of the script.
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using Microsoft.Office.Interop.Excel;
    namespace ST_53932a75e92c44f086535fc017a56e6a.csproj
    [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
    public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    #region VSTA generated code
    enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    #endregion
    The execution engine calls this method when the task executes.
    To access the object model, use the Dts property. Connections, variables, events,
    and logging features are available as members of the Dts property as shown in the following examples.
    To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
    To post a log entry, call Dts.Log("This is my log text", 999, null);
    To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
    To use the connections collection use something like the following:
    ConnectionManager cm = Dts.Connections.Add("OLEDB");
    cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
    Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
    To open Help, press F1.
    public void Main()
    // TODO: Add your code here
    ExcelRefresh(@"C:\Documents and Settings\ST84879\Desktop\ROBERT_DATA_SET\TEST.xls");
    Dts.TaskResult = (int)ScriptResults.Success;
    private void ExcelRefresh(string Filename)
    object NullValue = System.Reflection.Missing.Value;
    Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
    excelApp.DisplayAlerts = false;
    Microsoft.Office.Interop.Excel.Workbook Workbook = excelApp.Workbooks.Open(
    Filename, NullValue, NullValue, NullValue, NullValue,
    NullValue, NullValue, NullValue, NullValue, NullValue,
    NullValue, NullValue, NullValue, NullValue, NullValue);
    Workbook.RefreshAll();
    System.Threading.Thread.Sleep(20000);
    Workbook.Save();
    Workbook.Close(false, Filename, null);
    excelApp.Quit();
    Workbook = null;
    System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
    Thanks All
    Sri.Tummala

  • Word 2007 VBA vs Word 2010 VBA - Macro Failure

    Hi,
    I have a macro that when run in Word 2007 VBA works fine (Takes a Word Template, an Excel Spreadsheet and produces PDF output of merged documents).
    Sub mergethem_be() '
    ' merge1record_at_a_time Macro
    Dim fd As FileDialog
    'Create a FileDialog object as a Folder Picker dialog box.
    Set fd = Application.FileDialog(msoFileDialogFolderPicker)
    With fd
    'Use the Show method to display the Folder Picker dialog box and return the user's action.
    'The user pressed the button.
    If .Show = -1 Then
    For Each vrtSelectedItem In .SelectedItems
    'vrtSelectedItem is aString that contains the path of each selected item.
    'You can use any file I/O functions that you want to work with this path.
    'This example displays the path in a message box.
    SelectedPath = vrtSelectedItem
    Next vrtSelectedItem
    Else
    MsgBox ("No Directory Selected. Exiting")
    Exit Sub
    End If
    End With
    'Set the object variable to Nothing.
    Set fd = Nothing
    Application.ScreenUpdating = False
    MainDoc = ActiveDocument.Name
    ChangeFileOpenDirectory SelectedPath
    For i = 1 To ActiveDocument.MailMerge.DataSource.RecordCount
    With ActiveDocument.MailMerge
    .Destination = wdSendToNewDocument
    .SuppressBlankLines = True
    With .DataSource
    .FirstRecord = i
    .LastRecord = i
    .ActiveRecord = i
    docName = .DataFields("naam_mailing").Value & ".pdf"
    End With
    .Execute Pause:=False
    Application.ScreenUpdating = False
    End With
    ActiveDocument.ExportAsFixedFormat OutputFileName:=docName, ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:=True, UseISO19005_1:=False
    ActiveDocument.Close SaveChanges:=False
    Next i
    Application.ScreenUpdating = True
    End Sub
    If there are 31 rows in the spreadsheet it produces 31 PDF documents named based on the Name field in the Mail Merge Template.
    However when I use the same Macro code in Word 2010, same mail merge template and same source excel, it produces the first PDF and then generates an error on the bolded line as if there was no longer a document available.
    Now I know I use ActiveDocument.Close before going through the loop again, but that seems fine for Word 2007.
    Am I missing something really obvious here?

    If Bernie's ideas don't work, single step thru the code. Does the first file get created properly?
    What is the error? If the file isn't created, then the ActiveDocument refers to the template which isn't good to close!
    I suspect there is a different behavior in how Word 2010 works and your VBA code probably needs to reflect that, though VBA is usually very good at providing backwards compatibility.
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Business Objects Financial Consolidation - Excel Link and VBA Macros

    Hi
    We use the excel links of Business Objects Financial Consolidation V10.5 to import and export data to/from BOF and excel
    We used VBA macros for the imports but do not know what VBA code is required to export - this code would include the package identifier that has to be selected in the window "Select item Package "
    Can anyone help?

    Hello Chrisitne,
    I am as well intersted by the same funtiont, did you find any answer?
    Can I also ask you the VBA code for Import and Export if you have it?
    Thank for your help!

  • Run Data Package from custom Menu00F9/VBA macro

    HI guys,
    I have a problem:when creating VBA macro to run Data Package.
    I get the pop-up error "400" . This is the VBA code I'm using:
    Application.Run "MNU_eDATA_RUNPACKAGE(""Opening""; ""/CPMB/Opening_Balances""; ""Company""; ""Financial Processes"")"
    Have you any suggestion for me?
    Thanks
    Marco Uccello

    Hi Marco,
    I'm guessing by prompts you mean user inputs for Entity, Category, Time etc.
    These are controlled by the dynamic script associated with the data package.
    If you go to the menu eData -> Organise Packages then select a package and go through :
    Modify Package -> View Package -> Advanced
    You should get to the Data Manager Dynamic Script window.
    The following is an example of what should be in here. This is taken directly from the SAP How to Guide "How To Pass Dynamic Parameters to script logic.pdf"
    It's the "PROMPT" parts at the start that control the prompts shown to the user (and passed to the data package) :
    PROMPT(SELECTINPUT,,,,"%ENTITY_DIM%,%CATEGORY_DIM%,%CURRENCY_DIM%,%TIME_DIM%")
    PROMPT(TEXT,%WS_PERCT%,"Input W/S Percent in decimals",)
    PROMPT(TEXT,%EXP_PERCT%,"Input Exp. Percent in decimals",)
    INFO(%EQU%,=)
    INFO(%TAB%,;)
    TASK(ZBPC_PROMPT_EXP_RUN_LOGIC,TAB,%TAB%)
    TASK(ZBPC_PROMPT_EXP_RUN_LOGIC,EQU,%EQU%)
    TASK(ZBPC_PROMPT_EXP_RUN_LOGIC,SUSER,%USER%)
    TASK(ZBPC_PROMPT_EXP_RUN_LOGIC,SAPPSET,%APPSET%)
    TASK(ZBPC_PROMPT_EXP_RUN_LOGIC,SAPP,%APP%)
    TASK(ZBPC_PROMPT_EXP_RUN_LOGIC,SELECTION,%SELECTION%)
    TASK(ZBPC_PROMPT_EXP_RUN_LOGIC,LOGICFILENAME, INCREASEPERCENTAGE.LGF)
    TASK(ZBPC_PROMPT_EXP_RUN_LOGIC,REPLACEPARAM,WS_PERCT%EQU%%WS_PERCT%%TAB%EXP_PERCT%EQU%%EXP
    _PERCT%)
    If you paste that in exactly it will resolve into the right package information which can be seen one step back (via Modify Package -> View Package).
    You can modify the prompts as appropriate for the script you are running - the one above from the how to guide has two inputs for percentages which are used within the associated script logic calculation.
    Hope this helps.
    Thanks.
    Bradley Newcombe.

  • Blocked Error Messages and VBA Macros

    I have a client who is in the process of migrating their Essbase 6 VBA macros to 7. Will the error messages regarding the different APIs impede upon the macros running correctly and fully?<BR><BR>I don't think this would be the case but wanted to double-check...

    Hello.
    I have created an dynamic Excel VBA template which include as well this log-function.
    Public Function Create_Log(lngRow As Long, lngCol As Long, strLog As String)
        Dim lngCounter As Long
        Dim lngLast_Col As Long
        Dim strLog_Line As String
        lngCounter = lngRow
        lngLast_Col = lngCol
        strLog_Line = strLog
        If ThisWorkbook.Sheets("SAP_PROCESS").Cells(lngCounter, lngLast_Col).Value = "" Then
            ThisWorkbook.Sheets("SAP_PROCESS").Cells(lngCounter, lngLast_Col).Value = strLog_Line
        Else
            ThisWorkbook.Sheets("SAP_PROCESS").Cells(lngCounter, lngLast_Col).Value = ThisWorkbook.Sheets("SAP_PROCESS").Cells(lngCounter, lngLast_Col).Text & Chr(10) & strLog_Line
        End If
    End Function
    In my process code I use this function like this:
    'Log
    If Session.FindById("wnd[0]/sbar").Text <> "" Then Create_Log lngCounter, lngLast_Col, Session.FindById("wnd[0]/sbar").Text
    We can check as well if we receive an error (sy-msgty = 'E')
    If Session.FindById("wnd[0]/sbar").messagetype = "E" Then Create_Log lngCounter, lngLast_Col, Session.FindById("wnd[0]/sbar").Text
    Hope this give you an idea how to handle this.
    Best regards,
    Holger

Maybe you are looking for

  • SMS Text Features

    Will Apple come out with features for SMS Text such as copy and paste and options for us to be able to time stamp every outgoing and receiving text? Why does Apple not allow the user to have more choice in the settings on his/her phone?

  • Command in smf

    hi In my smartform I am using the 'command' option totrigger a new page ..i am getting an extra page at the end. Actually my form consists of 6 pages.But I am getting extra page--7. I need to avoid this extra page which is coming when i am using comm

  • Should I add Yosemite on a slow 2009 Imac

    Hi Everyone, I am debating loading the new OS on my old little Imac. It is running slow and I just bought more Ram that should bump it up 8GB? If I have room it maybe 12GB. I get the spinning wheel and web pages take a long time to load along with ap

  • Is there any way to include excluding one field

    hi all, is there any way to include a structure or type in another structure or type by excluding one field? regards hyma

  • File to Idoc Scenarion

    Hi All, I am sending a file from xi(File adapter as sender) to SAP xRPM (Idoc adapter as receiver). I have create all IR and ID objects.Here i am using poll interval 60.. While i am checking in SXMB_MONI , NO messages are there for this particular Se