Excel VBA & Current View

Hi
Is there a commend in Excel VBA for changing the BPC Current View selections ?
Thanks in advance for your help.
KInd Regards
Gav

Thanks for your reply, is there any way to actually change the current view itself from within VBA.
I have a sheet with many EvDREs in it, and would like my macro to cycle through selections in the current view and expand-all after each ( it then emails out the reports after each refresh ), so ideally I need to be able to change the Current View using the macro, rather than the EvCVW cells in the workbook itself.
Thanks for your help.

Similar Messages

  • BPC Excel VBA Code to change Current View ios broken, please help

    Hi,
    I inherited a macro set to cycle through a list of paramenters, change current view accordingly and print the reports. It was working fine in the prior version of BPC, but stopped when we transferred to BPC 7. The code stops when it's trying to make the Current View visible (in the prior version it was an option, in BPC 7 it's always visible). I also think it does not recognize the "OutlookSoft CPM CurrentView" name. I am not a VBA expert. Woudl appreciate any ideas. The place where the code stops is in bold below.
    Thank you!
    Sub cmdRun_Click()
    Dim strColHead As String, strRowHead As String, strDataRange As String
    Dim I As Integer, j As Integer, k As Integer
    Dim blnOldStatusBar As Boolean, blnOSBarStartVis As Integer, intOSBarStartPosit As Integer
    Dim strPL As String, strTabName As String
    Dim intTotalPrintingPages As Integer, intPageCountStart As Integer
    Dim dteStartTime As Date, dteEndTime As Date, intRunTimeSeconds As Integer, intRunTimeMinutes As Integer
    'Record the start time
    dteStartTime = Time
    'Get the current status bar setting.  Then, make sure the bar is visible
    blnOldStatusBar = Application.DisplayStatusBar
    Application.DisplayStatusBar = True
    If Test_Ranges = False Then
        Exit Sub
    End If
    strColHead = refColHeader.Value
    strRowHead = refRowHeader.Value
    strDataRange = refDataRange.Value
    'Find and store the starting position for the OutlookSoft Currentview toolbar
    'Then, make the entire OutlookSoft CurrentView toolbar visible
    Application.StatusBar = "Storing CurrentView toolbar data"
    blnOSBarStartVis = Application.CommandBars("OutlookSoft CPM CurrentView").Visible
    Application.CommandBars("OutlookSoft CPM CurrentView").Visible = True
    intOSBarStartPosit = Application.CommandBars("OutlookSoft CPM CurrentView").Position
    Application.CommandBars("OutlookSoft CPM CurrentView").Position = 4
    'Hide the form
    frmParameters.Hide
    'Cycle through the combinations of P&Ls and tab names
    For I = 1 To Range(strRowHead).Rows.Count
        'Change the currentview P&L
        Application.StatusBar = "Changing the CurrentView..."
        strPL = Range(strRowHead).Rows(I).Columns(1).Value
        ChangeCurrentView "P_L", strPL
        'Refresh and Expand
        'Application.Calculation = xlCalculationManual                      'temporarily turn off Excel's automatic calculation
        Application.Run "MNU_eTOOLS_EXPAND"
        'Application.Calculation = xlCalculationAutomatic                   'turn the automatic calculation back on
        Application.Run "MNU_eTOOLS_REFRESH"
        Application.CalculateFullRebuild
        'Get the total number of pages to be printed for the selected P&L
        Application.StatusBar = "Counting pages to be printed for this P&L..."
        intTotalPrintingPages = 0
        For j = 1 To Range(strColHead).Columns.Count
            If Range(strDataRange).Rows(I).Columns(j).Value = "x" Then
                strTabName = Range(strColHead).Rows(1).Columns(j).Value
                For Each pb In Sheets(strTabName).HPageBreaks
                    If pb.Extent = xlPageBreakPartial Then
                        intTotalPrintingPages = intTotalPrintingPages + 1  'add one sheet to the count for each page break
                    End If
                Next
                intTotalPrintingPages = intTotalPrintingPages + 1          'each sheet will print 1 more page than there are page breaks
            End If
        Next j
        Application.StatusBar = intTotalPrintingPages & " total pages for " & strRowHead
        'Cycle through each of the tabs (only if it is marked with an 'x')
        intPageStartCount = 0
        For j = 1 To Range(strColHead).Columns.Count
            If Range(strDataRange).Rows(I).Columns(j).Value = "x" Then
                strTabName = Range(strColHead).Rows(1).Columns(j).Value
                'Set the footer
                Application.StatusBar = "Building the page footer for " & strTabName & "..."
                Sheets(strTabName).PageSetup.CenterFooter = " Page &P+" & intPageStartCount & " of " & intTotalPrintingPages
                'Print the current sheet
                Application.StatusBar = "Printing " & strTabName & " for " & strRowHead & "..."
                Sheets(strTabName).PrintOut Copies:=1, Collate:=True
                'Bump up the start value for page numbering
                For Each pb In Sheets(strTabName).HPageBreaks
                    If pb.Extent = xlPageBreakPartial Then
                        intPageStartCount = intPageStartCount + 1          'add one sheet to the count for each page break
                    End If
                Next
                intPageStartCount = intPageStartCount + 1                  'each sheet will print 1 more page than there are page breaks
            End If
        Next j
    Next I
    'Put the OutlookSoft CurrentView toolbar back to where the user had it.
    Application.StatusBar = "Resetting the CurrentView toolbar"
    Application.CommandBars("OutlookSoft CPM CurrentView").Position = intOSBarStartPosit
    Application.CommandBars("OutlookSoft CPM CurrentView").Visible = blnOSBarStartVis
    'Alert the user that the process is complete
    Application.StatusBar = "Processing complete...notifing user"
    dteEndTime = Time
    intRunTimeSeconds = DateDiff("s", dteStartTime, dteEndTime)
    intRunTimeMinutes = intRunTimeSeconds \ 60
    If intRunTimeMinutes > 0 Then
        intRunTimeSeconds = intRunTimeSeconds Mod (intRunTimeMinutes * 60)
    End If
    For k = 1 To 3
        Beep
    Next k
    Application.DisplayStatusBar = blnOldStatusBar
    MsgBox "The report generation process is complete." & Chr(10) & _
        "Total retreival and printing time:" & Chr(10) & _
        "    Minutes: " & intRunTimeMinutes & Chr(10) & _
        "    Seconds: " & intRunTimeSeconds, vbOKOnly + vbInformation, "Process Complete"
    End Sub

    Sub cmdRun_Click()
    Dim strColHead As String, strRowHead As String, strDataRange As String
    Dim I As Integer, j As Integer, k As Integer
    Dim blnOldStatusBar As Boolean, blnOSBarStartVis As Integer, intOSBarStartPosit As Integer
    Dim strPL As String, strTabName As String
    Dim intTotalPrintingPages As Integer, intPageCountStart As Integer
    Dim dteStartTime As Date, dteEndTime As Date, intRunTimeSeconds As Integer, intRunTimeMinutes As Integer 'Record the start time
    For I = 1 To Range(strRowHead).Rows.Count 'Change the currentview P&L
        Application.StatusBar = "Changing the CurrentView..."
        strPL = Range(strRowHead).Rows(I).Columns(1).Value
        ChangeCurrentView "P_L", strPL 'Refresh and Expand
        'Application.Calculation = xlCalculationManual 'temporarily turn off Excel's automatic calculation
        Application.Run "MNU_eTOOLS_EXPAND"
        'Application.Calculation = xlCalculationAutomatic 'turn the automatic calculation back on
        Application.Run "MNU_eTOOLS_REFRESH"
        Application.CalculateFullRebuild 'Get the total number of pages to be printed for the selected P&L
        Application.StatusBar = "Counting pages to be printed for this P&L..."
        intTotalPrintingPages = 0
        For j = 1 To Range(strColHead).Columns.Count
            If Range(strDataRange).Rows(I).Columns(j).Value = "x" Then strTabName = Range(strColHead).Rows(1).Columns(j).Value
                For Each pb In Sheets(strTabName).HPageBreaks
                    If pb.Extent = xlPageBreakPartial Then intTotalPrintingPages = intTotalPrintingPages + 1 'add one sheet to the count for each page break
                    End If
                Next
            intTotalPrintingPages = intTotalPrintingPages + 1 'each sheet will print 1 more page than there are page breaks
            End If
        Next j
        Application.StatusBar = intTotalPrintingPages & " total pages for " & strRowHead 'Cycle through each of the tabs (only if it is marked with an 'x')
        intPageStartCount = 0
    -> Displays the line as programming code is not workin!
    Edited by: Sam Patel on Aug 27, 2009 12:45 PM
    Edited by: Sam Patel on Aug 27, 2009 12:45 PM
    Edited by: Sam Patel on Aug 27, 2009 12:46 PM
    Edited by: Sam Patel on Aug 27, 2009 12:47 PM
    Edited by: Sam Patel on Aug 27, 2009 12:47 PM
    Edited by: Sam Patel on Aug 27, 2009 12:49 PM
    Edited by: Sam Patel on Aug 27, 2009 12:49 PM
    Edited by: Sam Patel on Aug 27, 2009 12:50 PM

  • VBA Macro to Set Current View

    Does anybody know what command I could use in VBA to change the Current View in Excel for BPC 7M?
    Edited to add:
    I'm aware of the MNU_eTOOLS_MEMBERSELECTOR_x macro.  What I'm looking for is code to change the current view systematically without going through the member selector.
    Edited by: Will Leonard on Feb 22, 2010 1:26 PM

    Hi,
    Whenever I would like to change the current view via VBA, I use the methods which are released by opening a custom menu. However in most of the cases you dont want your end user to open a custom menu, but you would like to have the methods. Therefore I always do the following to simulate a custom menu (steps 1 to 4 can also be performed by opening a custom menu template and delete the unnessecary data).
    1) Create a new workbook and add the three new sheets
    2) Name the sheets, EV__RESULT,EV__MENUSTYLE and EV__DEFAULT
    3) In the sheet EV__DEFAULT type %DEFAULT% in range("A3")
    4) In the same sheet enter on row 4 the following items accross the columns:
    -%MenuItem%
    - Level
    - Action
    - P1
    - P2
    - P3
    - P4
    - CVOverride
    - NomalScreen
    5) Open the VBA editor and under thisworkbook module enter the following code:
    Private Sub Workbook_Open()
    Application.Run "MNU_ETOOLS_PSMANAGER_COMPILE"
    End Sub
    This code will compile the custom menu and will release all methods within it
    6) To change the current view enter the following code
    Sub Change_CV
    Application.Run "EVMACROCALL", "EVGOTOHOMESHEET", "", "", "", "", "<Your dimension>=<Your ID>", ""
    End sub
    Replace <Your dimension> with the dimension for which you would like to change the current view
    Replace <Your ID> with the member id code
    7) Hide the three sheet (EV__XXX).
    8) Close the file.
    9) Re-open the file and run the macro Change_CV and see if the CV has changed.
    You will now be able to change the current view via VBA. Only downside is that whenever the document is closed the methods will not be available anymore.
    BTW you can call any MNU command (e.g MNU_ETOOLS_REFRESH) and Custom menu function. For more information on the custom menu function see the help function and search for "Using custom menu functions". Refer to the CVoverride for an example on how to change the Current view between applications etc.
    HTH,
    Peter
    Edited by: d. G. PETER on Jun 4, 2010 4:23 PM

  • 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/

  • Changes in the Dimensions not reflected in the Current View and Excel Sheet

    Hi Experts,
    We're using BPC MS Platform Version 7.0.112 and we're having problems. When we make changes in the dimension members like adding members or making changes in the hierarchy or groupings, it takes time for the changes to reflect in current view or in the excel sheet. After full processing of the dimension we can see the changes we've made when we reopen the dimension member but when we try to use the member we've added in the template, it's not yet in the current view. I've already tried, full processing of all the dimensions, processing application and reassigning aql index, refresh dimension members and yet the changes we've made doesnt appear in the current view. And what's odd is that sometimes the changes we've made would appear after a day or two or nothing at all.
    What could be possibly causing this issue?
    Thanks,
    Marvin

    Hi Dzmitry,
    Thanks for your response, I'm just wondering whats causing this? We never had this issue on older versions of BPC though, so it would really help if we would know the cause of this. Basicaly when do changes in a dimension, after processing (Full Process, System Offline and Process through member sheet), we just had to set the AppSet status to available and refresh the dimension members in Excel and all the changes would already be visible.
    Thanks,
    Marvin

  • Problem with controlling Annotations from Excel VBA

    Hi,
    I have a PDF document that has plenty of sticky notes attached to it. These sticky notes have been added by multiple authors on all pages of the document. I am trying to import the contents of these sticky notes, their author and the page number to an excel spreadsheet.  I am using Excel 2007 and Acrobat Professional 9.0.
    This is the code that I am currently using to import the sticky notes, but the problem that I am facing is that when I run the macro -
    Same sticky note contents, author and page numbers are imported multiple times
    Not all sticky notes are imported, only some of them appear in the final excel spreadsheet
    When I compare the number of sticky notes to that in the original PDF file, the number is correct. But the content is repeated content and that is the reason why only some of the sticky notes are imported.
    This is an activity that I need to do on regular basis and the number of sticky notes that I need to import to excel may range between 100 to 200. It is really difficult to do this task manually, so an excel VBA macro could prove really helpful.
    Sub ImportComments_Click()
    Dim Fpath As String
    Dim WordObj As Object
    Dim wbkOutput As Excel.Workbook
    Dim iRow As Integer
    Dim i, j, k As Integer
    Dim lRet As Long
    Dim objAcroAVDoc As New Acrobat.acroAVDoc
    Dim objAcroPDDoc As Acrobat.AcroPDDoc
    Dim numPages As Long
    Dim lAnnotscnt As Long
    Dim Subtype As String
    Dim NumComments As Long
    Dim AcroApp As Acrobat.AcroApp
    Dim objAcroPDPage As Acrobat.AcroPDPage
    Dim annot As Acrobat.AcroPDAnnot
    Sheets("Defect Log").Select
    Range("L3").Activate
    Fpath = ActiveCell.Value
    Sheets("Defect Log").Select
    Range("A1").Activate
    i = 0
    Do While (Not (IsEmpty(ActiveCell.Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 1).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 2).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 3).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 4).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 5).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 6).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 7).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 8).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 9).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 10).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 11).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 12).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 13).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 14).Value)))
    i = i + 1
    ActiveCell.Offset(1, 0).Select
    Loop
    iRow = i + 1
    Set wbkOutput = ActiveWorkbook
    lRet = objAcroAVDoc.Open(Fpath, "")
    Set objAcroPDDoc = objAcroAVDoc.GetPDDoc
    numPages = objAcroPDDoc.GetNumPages()
    Set objAcroPDPage = objAcroPDDoc.AcquirePage(0)
    For k = 1 To numPages
    lAnnotscnt = objAcroPDPage.GetNumAnnots()
    For m = 0 To lAnnotscnt - 1
    If lAnnotscnt = 0 Then Exit For
    Set objAcroPDAnnot = objAcroPDPage.GetAnnot(m)
    If (objAcroPDAnnot.GetContents <> "" And objAcroPDAnnot.GetSubtype = "Text") Then
    Cells(iRow, 5).Value = k
    Cells(iRow, 2).Value = objAcroPDAnnot.GetContents()
    Cells(iRow, 11).Value = objAcroPDAnnot.GetTitle()
    iRow = iRow + 1
    End If
    Next m
    Set objAcroPDPage = objAcroPDDoc.AcquirePage(k)
    Next k
    lRet = objAcroAVDoc.Close(1)
    Set objAcroAVDoc = Nothing
    Set objAcroPDAnnot = Nothing
    Set objAcroPDPage = Nothing
    Set objAcroPDDoc = Nothing
    End Sub

    Make sure you are current with 9.x patches, just on general principles.
    The code seems fine – nothing jumping out at me.
    You can also look at using the JSObject methods and trying this via the JavaScript stuff – that will give you more access to the Annotation information…
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Thu, 24 Nov 2011 04:25:12 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Problem with controlling Annotations from Excel VBA
    Problem with controlling Annotations from Excel VBA
    created by apreeti<http://forums.adobe.com/people/apreeti> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4044740#4044740

  • Calling UDF (MS Access) from Excel VBA

    Hi,
    I need to run a query on an MS Access database that has to perform a weekday calculation between two date columns,
    and this query has two date parameters that it receives dynamically. I am using Excel VBA as the front end.
    Select AgeRange, count(*) from
    (Select IIF(networkdays(date1,date())<=2, "0-2 days","over 2 days")) as AgeRange
    from table1
    where date2 >= startdt
    and date2 <=enddt
    ) d
    group by AgeRange
    The actual query is more complex, but this will help illustrate the issue. I build a string variable with
    the query, and substitute Startdt and enddt variables with the actual values. I then create a new QueryDef object and get the results from OpenRecordSet.
    Except, Networkdays is not a valid function in MS Access. So, this query fails.
    I created a WorkDays UDF in MS Access, and used that instead - the query works fine in MS Access, but when
    I try to pass it in the QueryDef object, it fails with 3085 error (function not available).
    I'm not sure how to get around this, and could use some help.
    In summary, I need to run a select query that will calculate weekdays or workdays between two columns (query
    is dynamic - dates are variable) from VBA to MS Access, get the results back to VBA so that I can populate the results. Any suggestions are appreciated and welcome.
    Thanks!
    I tried using datediff with the "w" parameter, but that doesn't work as I had hoped - it gives the
    number of weeks between the dates instead of weekdays
    I realize that I could get all the data (without doing the group by) down into Excel and then, do the networkdays
    formula calculation there, and summarize after that, but that is a very inefficient way - and defeats the purpose of having an access database in the first place. Getting tens of thousands of records is going to cause space issues in Excel too.

    Hi Bob,
    One solution is to create a table in the Access database storing all the dates in these years, add a column to determine if this date is a week day or not. And create another table to store the dates that are to be excluded from the working days.
    In this way, you need to create a separate query to count the valid working days based on the two tables. So the most difficult thing is to create the table that contains all the dates, please check this VBA code snippet which helps you to insert all the
    dates into the table.
    Sub InsertDatesIntoTable()
    Dim StartDate As Date
    Dim EndDate As Date
    Dim d As Date
    Dim w As Integer
    Dim IsWorkDay As Boolean
    StartDate = #1/1/2015#
    EndDate = #12/31/2015#
    For d = StartDate To EndDate
    Debug.Print d
    w = Weekday(d, vbSunday) 'first day of the week is Sunday
    If w = 1 Or w = 7 Then ' if the current day is Sunday or Satuday
    IsWorkDay = False
    Else
    IsWorkDay = True
    End If
    'Here you can insert d and IsWorkDay into the table
    Next d
    End Sub
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Excel VBA to access sharepoint list without permission

    Hi,
    I do find solution to retrieve the SharePoint list from excel VBA but my problem now is on the SharePoint permission to the list.
    I am developing this solution in excel because i don't want the particular user to access the list direct from the portal because the list contains some unique and confidential data. So what i did was created a new view in the portal with selected column
    and i connect to the view from excel. So every time the user want to retrieve the data, he can run macro to refresh the data in the excel.
    When i run the macro it can generate the list because i do have permission but if i run the same macro on the person machine, excel request for username and password because he don't have the permission to the list.
    Are there any work around to allow the user to generate the data in excel without permission to the SharePoint list.
    Thanks for the help.

    I've done this before using SQL Server Reporting Services integrated into SharePoint.
    Using SSRS, create the report you want the end user to view. Then create a Report Subscription, emailing the end user (or putting it in a file share/Doc Lib) the report. If they want to run it interactively, you can enable caching on the report, which would
    pull the report from the last time it was scheduled to run (the data would not be 'real time' in this case).
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Using Excel VBA to Print to PDF File?

    Hi, All !!
    I have an Excel VBA application that creates Excel reports.  These need to be sent external to our company in PDF format.  I've downloaded the Acrobat SDK and have found the VB sample for AdobePDFSilent.  Unfortunately, it appears that this is written for VB or VB.Net as I don't have any of the data types available that are created in the code.  However, from another forum, I've gotten some VB code that appears to do many of the processes included in the SDK sample.
    The code below doesn't give me any errors, but no PDF file is created.
    My VBA code
    Declare Function RegOpenKeyA Lib "advapi32.dll" ( _
        ByVal Key As Long, _
        ByVal SubKey As String, _
        NewKey As Long) As Long
    Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
        ByVal hKey As Long, _
        ByVal lpValueName As String, _
        ByVal Reserved As Long, _
        ByVal dwType As Long, _
        lpData As Any, _
        ByVal cbData As Long) As Long
    Declare Function RegCloseKey Lib "advapi32.dll" ( _
        ByVal hKey As Long) As Long
    Sub TestPrintPDF()
        Dim strDefaultPrinter As String
        Dim strOutFile As String
        Dim lngRegResult As Long
        Dim lngResult As Long
        Dim dhcHKeyCurrentUser As Long
        Dim PDFPath As String
        Const dhcRegSz As Long = 1
    1    Workbooks.Open ("\\master\fnshares\bcbcm\Client Management\Client Services\New Account Fees\09 September 2010\3Q10 Rebate Ltrs\Infi\MacroTest\A02.xls")
    2    Select Case ActiveWorkbook.Sheets.Count
    3        Case 1
    4            Sheets(1).Select
    5        Case 2
    6            Sheets(Array(Sheets(1).Name, Sheets(2).Name)).Select
    7        Case 3
    8            Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name)).Select
    9        Case 4
    10            Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, Sheets(4).Name)).Select
    11        Case 5
    12           Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, Sheets(4).Name, Sheets(5).Name)).Select
    13      Case 6
    14         Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, Sheets(4).Name, Sheets(5).Name, Sheets(6).Name)).Select
    15  End Select
    16  dhcHKeyCurrentUser = &H80000001
    17  strDefaultPrinter = Application.ActivePrinter
    18  PDFPath = ActiveWorkbook.Path & Application.PathSeparator 'The directory in which you want to save the file
    19  strOutFile = PDFPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & ".pdf" 'Change the pdf file name if required. This should have the fully qualified path
    20  lngRegResult = RegOpenKeyA(dhcHKeyCurrentUser, "Software\Adobe\Acrobat Distiller\PrinterJobControl", lngResult)
    21  lngRegResult = RegSetValueEx(lngResult, Application.Path & "\Excel.exe", 0&, dhcRegSz, ByVal strOutFile, Len(strOutFile))
    22  lngRegResult = RegCloseKey(lngResult)
    23  ThisWorkbook.ActiveSheet.PrintOut copies:=1, ActivePrinter:="Adobe PDF"
    24  Application.ActivePrinter = strDefaultPrinter
    25  ActiveWorkbook.Close False
    End Sub
    From what I can determine, the lines 17 & 24 combined basically accomplish the same thing as the SaveandUpdateDefaultPrinter function in the SDK (get and save the current default printer and return it to that default after printing the PDF).
    Line 20 opens the Registry key for Distiller\PrinterJobControl which is done in part of the ConvertFile function in the following SDK code.
    SDK Code
                Dim objDistillerRegKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot
                Dim strDistillerSubKey As String = "SOFTWARE\\Adobe\\Acrobat Distiller\\PrinterJobControl"
                'Open Current User's Distiller Subkey for writing
                objDistillerRegKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(strDistillerSubKey, True)
    Line 21 sets the Registry key for Excel with the name of the PDF file to output which also appears to be done in part of the ConvertFile function in the following code.
    SDK Code
               If (Not objDistillerRegKey Is Nothing) Then     'set reg key value for this app and file
                    objDistillerRegKey.SetValue(strAppPath, strOutputFile)
                    objDistillerRegKey.Close()
                End If
    I have verified, using RegEdit, that this Registry key does get set with the desired output filename.
    Line 23 prints the Excel file to PDF when done manually (this was recorded using the Excel Macro Recorder).  This should be comparable to the PrintToAdobePDF function in the SDK as below.
    SDK Code
        Private Sub PrintToAdobePDF(ByVal InputfilePath As String)
            'Prints InputFilePath to the AdobePDF printer.
            'Since we just gathered all this info programmatically,
            'this function assumes the file is present, that it has an
            'associated application and that the current user has print privileges.
            'Define properties for the print process
            Dim pProcInfo As New ProcessStartInfo
            pProcInfo.FileName = InputfilePath
            pProcInfo.Verb = "Print"
            'Make process invisible
            pProcInfo.CreateNoWindow = True
            pProcInfo.WindowStyle = ProcessWindowStyle.Hidden
            'start print process
            Dim pMyProc As Process = Process.Start(pProcInfo)
            pMyProc.WaitForExit()
        End Sub
    These are some of the statements I can't do because I don't have a ProcessStartInfo type.  What am I doing wrong or NOT doing that the PDF file is not created?  I hope I've described my situation in enough, but not too much detail.  Thanks for your help.
    Nate Brei

    Reinhard & Karl Heinz,
    Thank you both for your responses and willingness to work with me on this problem.  This is driving me crazy & is getting very frustrating.  It seems that I've tried everything that people have suggested (I've also posted on a VB Forum that I subscribe to) and I'm basically doing what works for everyone else but doesn't work for me.  I've got to be close.
    Reinhard, regarding your last post, it doesn't appear to be a one-time setting.  Everytime I come into the Printers Property box (even after I've printed a PDF document manually, that option about system & document fonts is ALWAYS turned on.  If it is a registry setting, please let me know how to turn it off.  I'm using Adobe Acrobat 9 Standard.
    Karl Heinz, I've tried that based on my initial post (see the code there).  Since your post, I tried it again.  I get the same result, NO FILE is produced anywhere.
    I wish I could post pictures, but evidently I can't.  So, I going to post first my code (in case you want to try to recreate my problem), then the values of the variables in that code when I run it (so you can I have everything set correctly as far as I know), and finally, the values of the Registry entries that I have after I run it.  So, please bear with me as the post may be a little long.
    My Code
    Declare Function RegOpenKeyA Lib "advapi32.dll" ( _
        ByVal Key As Long, _
        ByVal SubKey As String, _
        NewKey As Long) As Long
    Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
        ByVal hKey As Long, _
        ByVal lpValueName As String, _
        ByVal Reserved As Long, _
        ByVal dwType As Long, _
        lpData As Any, _
        ByVal cbData As Long) As Long
    Declare Function RegCloseKey Lib "advapi32.dll" ( _
        ByVal hKey As Long) As Long
    Sub TestPrintPDF()
        Dim strDefaultPrinter As String
        Dim strOutFile As String
        Dim lngRegResult As Long
        Dim lngResult As Long
        Dim dhcHKeyCurrentUser As Long
        Dim PDFPath As String
        Const dhcRegSz As Long = 1
        'Workbooks.Open ("\\master\fnshares\bcbcm\Client Management\Client Services\New Account Fees\09 September 2010\3Q10 Rebate Ltrs\Infi\MacroTest\A02.xls")
        Workbooks.Open ("H:\A02.xls")
        Select Case ActiveWorkbook.Sheets.Count
            Case 1
                Sheets(1).Select
            Case 2
                Sheets(Array(Sheets(1).Name, Sheets(2).Name)).Select
            Case 3
                Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name)).Select
            Case 4
                Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, _
                 Sheets(4).Name)).Select
            Case 5
                Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, _
                 Sheets(4).Name, Sheets(5).Name)).Select
            Case 6
                Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, _
                 Sheets(4).Name, Sheets(5).Name, Sheets(6).Name)).Select
        End Select
        dhcHKeyCurrentUser = &H80000001
        strDefaultPrinter = Application.ActivePrinter
        'The directory in which you want to save the file
        PDFPath = ActiveWorkbook.Path & Application.PathSeparator
        'Change the pdf file name if required. This should have the fully qualified path
        strOutFile = PDFPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & ".pdf"
        lngRegResult = RegOpenKeyA(dhcHKeyCurrentUser, "Software\Adobe\Acrobat Distiller\PrinterJobControl", _
            lngResult)
        lngRegResult = RegSetValueEx(lngResult, Application.Path & "\Excel.exe", 0&, dhcRegSz, _
            ByVal strOutFile, Len(strOutFile))
        lngRegResult = RegCloseKey(lngResult)
        ThisWorkbook.ActiveSheet.PrintOut copies:=1, ActivePrinter:="Adobe PDF"
        'ThisWorkbook.ActiveSheet.PrintOut copies:=1, preview:=False, ActivePrinter:="Adobe PDF", _
            printtofile:=True, collate:=True, prtofilename:=strOutFile
        'Call printToPdf(strOutFile)
        Application.ActivePrinter = strDefaultPrinter
        ActiveWorkbook.Close False
    End Sub
    Sub printToPdf(PDFFilename)
        ' Define a postscript file name
        PSFileName = "H:\TempPostScript.ps"
        ' Print the Excel range to the postscript file
        'Dim MySheet As Worksheet
        'Set MySheet = ActiveSheet
        ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False, ActivePrinter:="Adobe PDF", _
            printtofile:=True, collate:=True, prtofilename:=PSFileName
        ' Convert the postscript file to .pdf
        Set myPDF = CreateObject("PdfDistiller.PdfDistiller.1")
        myPDF.FileToPDF PSFileName, PDFFilename, ""
    End Sub
    Values of my Variables When I Run the Code
    ? dhcHKeyCurrentUser
         -2147483647
    ? strDefaultPrinter
         \\tcps01p\FNT12W00 Canon 5020 PCL 5e on Ne04:
    ? PDFPath
         H:\
    ? strOutFile
         H:\A02.pdf
    ? lngResult
         2280
    ? Application.Path & "\Excel.exe
         C:\Program Files\Microsoft Office\OFFICE11\Excel.exe
    ? dhcRegSz
         1
    ? Len(strOutFile)
         10
    ? PSFileName
         H:\TempPostScript.ps
    ? PDFFilename
         H:\A02.pdf
    Values of my Registry Entries (HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\PrinterJobControl)
    (Default)          REG_SZ          (value not set)
    C:\Program Files\Microsoft Office\OFFICE11\Excel.exe          REG_SZ          H:\A02.pdf
    LastPdfPortFolder - EXCEL.EXE          REG_SZ          "Q:\Client Management\Client Services\New Account Fees\09 September 2010\3Q10 Rebate Ltrs\Infi\MacroTest
    Note:  There are a couple of other entries for documents that I've printed manually that I didn't include.  Also, the last entry above, contains the value of the folder that I last manually "printed" to.
    I've also noticed that I have a Registry SubKey under PrinterJobControl called DownloadFonts.  However, the only entry there is:
         (Default) REG_SZ (value not set)
    Is this the registry key you mentioned, Reinhard?
    As you can see in my code, I have 3 different methods that I've tried to print.  The first one defaults everything after selecting the Acrobat PDF printer.  The second sets the output filename as a PDF (basically what you suggested, Karl Heinz).  The third method calls a procedure that prints to a PostScript file & then uses Distiller to print from that file to pdf.  This is the method Reinhard suggested.
    With the first 2 methods, I get NO error messages, but no file(s) show up.  With the 3 method, I get the error about the Fonts checkbox, but it creates a 0K PostScript file.  When I skip that statement and run the other 2 statements, I get a log file that says the PostScript file is empty and not PDF file was created.
    YIKES...  What's going on?  Thanks again for attempting to help me!!!
    Nate

  • CALL RFC DATA FROM TWO LINKED TABLES IN EXCEL VBA

    Hi,
    I am using Excel VBA to call information from tables in SAP.
    This is working correctly, however I now need to be able to call information from another table where the two tables are linked by a common data field.
    Example.
    The first table I have lists all items in stock and contains an article number. The second table contains all article numbers and their descriptions.
    I want to be able to call the first table but to have the article codes description on there aswell.
    Here is the code I am currently using.
    Sub GetTable()
    'Connect to SAP
    Dim sapConn As Object 'Declare variant
    Set sapConn = CreateObject("SAP.Functions") 'Create ActiveX object
    sapConn.Connection.System = "QA2"
    sapConn.Connection.client = "900"
    sapConn.Connection.user = "mbrough"
    sapConn.Connection.Password = "st34lh"
    sapConn.Connection.Language = "EN"
    If sapConn.Connection.Logon(1, False) <> True Then 'Try Logon
       MsgBox "Cannot Log on to SAP"
    End If
    'Define the table specifics
    Dim objRfcFunc As Object
    Set objRfcFunc = sapConn.Add("RFC_READ_TABLE")
    Dim objQueryTab, objRowCount As Object
    Set objQueryTab = objRfcFunc.Exports("QUERY_TABLE")
    objQueryTab.Value = "LQUA"
    Set objRowCount = objRfcFunc.Exports("ROWCOUNT")
    objRowCount.Value = "15000"
    Dim objOptTab, objFldTab, objDatTab As Object
    Set objOptTab = objRfcFunc.Tables("OPTIONS")
    Set objFldTab = objRfcFunc.Tables("FIELDS")
    Set objDatTab = objRfcFunc.Tables("DATA")
    'Set the condition and refresh the table
    objOptTab.FreeTable
    objOptTab.Rows.Add
    objOptTab(objOptTab.RowCount, "TEXT") = "LGTYP BETWEEN 'K01' AND 'K06'"
    'Set fields to obtain and refresh table
    objFldTab.FreeTable
    'Then set values to call
    objFldTab.Rows.Add
    objFldTab(objFldTab.RowCount, "FIELDNAME") = "LGNUM"
    objFldTab.Rows.Add
    objFldTab(objFldTab.RowCount, "FIELDNAME") = "MATNR"
    objFldTab.Rows.Add
    objFldTab(objFldTab.RowCount, "FIELDNAME") = "WERKS"
    objFldTab.Rows.Add
    objFldTab(objFldTab.RowCount, "FIELDNAME") = "LGTYP"
    objFldTab.Rows.Add
    objFldTab(objFldTab.RowCount, "FIELDNAME") = "LGPLA"
    objFldTab.Rows.Add
    objFldTab(objFldTab.RowCount, "FIELDNAME") = "GESME"
    objFldTab.Rows.Add
    objFldTab(objFldTab.RowCount, "FIELDNAME") = "VERME"
    objFldTab.Rows.Add
    objFldTab(objFldTab.RowCount, "FIELDNAME") = "MEINS"
    If objRfcFunc.Call = False Then
       MsgBox objRfcFunc.Exception
    End If
    Dim objDatRec As Object
    Dim objFldRec As Object
    For Each objDatRec In objDatTab.Rows
       For Each objFldRec In objFldTab.Rows
          Cells(objDatRec.Index, objFldRec.Index) = _
                Mid(objDatRec("WA"), objFldRec("OFFSET") + 1, objFldRec("LENGTH"))
       Next
    Next
    End Sub
    The table which contains the article descriptions is called 'MAKT' and this table also contains the column 'MATNR' which is the article field.
    Many thanks,
    Mike

    Is there no way of connecting the tables within the code.
    IT won't give me access to SE11
    Thanks,
    Mike

  • Default settings for Current View

    Hi there experts,
    I am experiencing the a problem with the default current view on different PCs.
    I have input schedules that use EVTIM on the months of my time dimension.
    Every time a new user opens this input schedule on a new PC the default current view for time shows the highest hierarchy node which in my case is FIscal Year.
    This will then result in errors in my input schedule (because the EVTIM cant generate the next members) until the user has changed the time to the correct selection. This behaviour makes sense if you know how what BPC is doing but it causes major confusion for end users.
    Is there any way (other than harcoding) to set a default current view for dimensions? Even for locked dimensions I have noticed that once you open the schedule on a differnt PC the dimension is still locked but it defaults to the highest hierarchy node.
    Thank you!
    Sabine

    Hi Sabine,
    You might try using a dimension lock (ref. Action Pane) on the Time dimension.
    Alternatively, in Excel somewhere hidden you can create a list of 'if' statements for each dimension (e.g. EvPRO(app,mbr,CALC)="N") returning 0 or 1. Put a subtotal at the bottom so that when it is not 0 it indicates you have a problem with the settings of the dimensions.
    You can now display a message for each invalid dimension setting using conditional highlighting on some visible cells.
    You can also put a 'if" statement in front of the EvDRE (e.g. if( D22 =0,EVDRE(...),"ERROR") ), or something similar for non EVDRE schedules.
    While this doesn't fix the settings it will stop your schedule going wonky
    Hope this helps.
    G.

  • Problem with SQL Query in Excel VBA

    I am trying to retrieve data from a SQL table using Excel VBA.  The query will only return data from the first field in the query.  this is the code I am using:
    objGroupConn.Open
    Set objGroupCmd.ActiveConnection = objGroupConn
    objGroupCmd.CommandText = "SELECT GroupName, GroupNotes, GroupTotal, ArrivalTime" _
    & " FROM dbo.tblGroups" _
    & " WHERE((tblGroups.VisitDate)= '" & vdate & "')"
    objGroupCmd.CommandType = adCmdText
    objGroupCmd.Execute
    Set objGroupRecordset.ActiveConnection = objGroupConn
    objGroupRecordset.Open objGroupCmd
    ActiveSheet.Range("BN5").CopyFromRecordset (objGroupRecordset)
    objGroupRecordset.Close
    objGroupConn.Close
    The query is asking for information from 4 fields and only returns GroupName.  Any ideas?

    Hi GAMinTN,
    I can't reproduce your problem, if I created the same table as yours, I can successfully retrieve the data from the table and copy to the specified range.
    I recommend that you firstly check if the table in the database contains the proper data in all the 4 columns. Since the command text can be executed successfully and get the data of one column, it should be able to get the data from the other columns.
    Also please debug your code, check if the objGroupRecordset contains the proper data, and try to execute the SQL statement directly in the Sql Server, make sure the SQL statement is correct.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Current View as filter in BPC Vs Planning level and package in BPS

    Hi,
         If I understand correctly, the current view is as like a filter in BPC as planning level and package in BPS, by comparing then I notice that the value for current can only be single value while in planning level and package we can have range, multiple value of single value.
        Let's have a planning scenario  we need to planning for every month based on the actual month data,
    in BPS we can easily configure two type of columns with actual and planning data, while in BPC, since the current view only  allow single value, we have to copy the actual data to planning data, then with the category set to planning, we can do our planning. Of course if there is hierarchy, we can use parent to allow to display all the child.
       The other option is to use the EvGTS function which can retrieve the data outside the current view.
       Anybody have other though on this?
    Edited by: JW on Jan 7, 2009 5:51 PM
    Edited by: JW on Jan 7, 2009 6:25 PM

    Hi JW-
    I did not mean to imply that the Current View (CV) is not a filter.  It can definitely be used to filter data presented from an EVDRE as well as other Ev functions, just like filters in BPS and IP.  However as a developer you have the option to use the CV or, through your configuration, disregard and/or override the CV settings.
    One example of disregarding CV settings is using standard Excel functions to provide the user a dropdown list from which to select certain dim members.  The drop down box selection could be used instead of the CV for defining Ev function selections.  My point is that you have multiple design paths of controlling what data is selected/processed; you are not only limited to the CV values.  From a performance viewpoint, you are correct in assuming that limiting the data selection will greatly impact overall performance.  Using the CV to limit data selection to enhance performance is very valid approach, just be aware that there are several alternative ways (other than using CV to control data selection) available to the developer.
    -Sheldon

  • Daq with excel vba

    Hello,
    I'm working with Excel VBA and I have a 6024E card. I'd like to know where I can download the CW DAQ 3.0.1 and if there is a documentation describing the functionality of the CW DAQ.
    With kind regards
    Alexander Heß 

    Hello Alex,
    you are able to use 3 different drivers for the device.
    DAQmx,Traditional DAQ or DAQmx Base.
    I didnt found any 3.0.1 version.
    Only a 3.1 version of the DAQmx Base driver.
    http://joule.ni.com/nidu/cds/view/p/id/970/lang/de
    Here a link to the DAQcard overview with the latest driver software: http://zone.ni.com/devzone/cda/tut/p/id/6910#eseries
    Kind regards,
    Elmar

  • BUSINESS PROCESS FLOW (BPF) TASK SETUP - CURRENT VIEW OPTIONS

    This article explains a few findings regarding the options on Current View Type for setting up Business Process Flow tasks and will discuss BPC for Excel, Data Manager and BPC Web tasks.
    Future posts will cover more tasks.
    This is valid for 5.x versions only.
      IMPORTANT NOTE:
    DATA MANAGER PACKAGES
        Data Manager Packages tasks such as Run Specific Package, Run User Package are not integrated
        with the Current View Type selection. Therefore, the options Inherit from Data Region, Inherit from
        Current View or Member Lookup does not work on Data Manager Packages. This is due to the diversity of Data Manager Packages, such as Import, Export, Clear, Default Formulas, each of them requiring a complete different set of parameters, some of them not related to the Current View.
    1. INHERIT FROM DATA REGION
      Once you choose to Open a BPF from BPC for Excel, you are prompted to choose the Data
      Region. Upon setting the desired Data Region, the Current View is changed
      accordingly on BPC Web.
        OPEN TEMPLATE / REPORT LIBRARY / SCHEDULE LIBRARY
        If a step is defined as Open Template/Report Library/Schedule Library
        and INHERIT FROM DATA REGION is set to one (or more) of the Data Region
        dimensions, the Current View on BPC for Excel should change to match
        the settings done Data Region settings, being the same as the one on BPC Web.
        SET WORK STATUS
        Same as above.
    2. INHERIT FROM CURRENT VIEW
        OPEN TEMPLATE / REPORT LIBRARY / SCHEDULE LIBRARY
        If a step is defined as Open Template/Report Library/Schedule Library and INHERIT FROM
        CURRENT VIEW is set to one (or more) dimensions, the report will pickup the Current View
        from BPC Web and BPC for Excel should change to match the Current View,
        being the same as the one on BPC Web.
        Example:
        1. Log on to BPC Admin on ApShell -> Manage Application Sets;
        2. Go to Business Process Flows -> Budgeting Process;
        3. Grant access to the BPF to your test user;
        4. Check Sub-Step 1 of Step 1 - Check Budget Data. This steps has a
           INHERIT FROM CURRENT VIEW setup (ENTITY).
        5. Log on to BPC Web on ApShell;
        6. Go to Open a Business Process Flow and choose Budgeting Process;
        7. Choose the desired Data Region;
        8. On BPC Web, verify the value setup for ENTITY on the Current View;
        9. Open the Check Budget Data;
        10. The ENTITY on the Current View will be set up accordingly to what
            was set on BPC Web.
        SET WORK STATUS
        Same as above.
    3. MEMBER LOOKUP
        OPEN TEMPLATE / REPORT LIBRARY / SCHEDULE LIBRARY
        If a step is defined as Open Template/Report Library/Schedule Library and MEMBER LOOKUP
        is set to one (or more) dimensions, the report will set the Current View
        on BPC for Excel to the member that was configured.
        Example:
        1. Log on to BPC Admin on ApShell -> Manage Application Sets;
        2. Go to Business Process Flows -> Budgeting Process;
        3. Grant access to the BPF to your test user;
        4. Check Sub-Step 1 of Step 1 - Check Budget Data. This steps has a
           MEMBER LOOKUP setup (CATEGORY).
        5. Log on to BPC Web on ApShell;
        6. Go to Open a Business Process Flow and choose Budgeting Process;
        7. Choose the desired Data Region;
        8. On BPC Web, verify the value setup for CATEGORY on the Current View;
        9. Open the Check Budget Data;
        10. The CATEGORY on the Current View will be set up accordingly to what
            was set on the Task configuration, in other words, there should be BUDGET set
            on the Current View.
        SET WORK STATUS
        Same as above.
    REFERENCES
    This is an unofficial addendum for the SAP BPC 5.1 ADMINISTRATION USER'S GUIDE on:
    PAGE 54 - Managing Business Process Flows
    PAGE 57 - Adding new business process flows -> To add a step -> Select the current view type
    SAP BPC 5.1 ADMINISTRATION USER'S GUIDE can be found on [BPC Instalation Guides and User Guides|http://service.sap.com/instguidescpm-bpc].
    Edited by: Gustavo Bortoloti on Dec 15, 2008 6:48 PM

    Hi Gustavo Bortoloti,
    That's right, the SAP BPC version 5.x SP x not have the specific setting.
    Thanks,
    Wandi Sutandi

Maybe you are looking for