Macro

hi all,
       i am trying to use a Macro in the standard User exit MV45AFZA,MV45ATZZ.
i am writing following code but it gives the error for the below code.
***INCLUDE MV45ATZZ .
This include is reserved for user modifications                      *
Additional data definitions                                          *
The name of additional data definitions should begin with 'ZZ'.      *
DATA: ZZFIELD(8) TYPE C.
*{   INSERT         WRDK900243                                        1
Shared forms and data declarations
  DEFINE ZZCHKSTATUS.
    ADD 1 TO &1.
  END-OF-DEFINITION.
  DATA NUMBER TYPE I VALUE 1.
  ZZCHKSTATUS NUMBER.
INCLUDE zzsdi_mv45atzz.
*}   INSERT
Thanks and Regards,
Ram.

Hai Go through the following Document
Macros can only be used in the program the are defined in and only after the definition are expanded at compilation / generation. Subroutines (FORM) can be called from both the program the are defined in and other programs . A MACRO is more or less an abbreviation for some lines of code that are used more than once or twice. A FORM is a local subroutine (which can be called external). A FUNCTION is (more or less) a subroutine that is called external. Since debugging a MACRO is not really possible, prevent the use of them (I’ve never used them, but seen them in action). If the subroutine is used only local (called internal) use a FORM. If the subroutine is called external (used by more than one program) use a FUNCTION
Thanks & regards
Sreeni

Similar Messages

  • Macro to open and save as a value in a cell

    How can I create a macro (I've named it Test) that will:
    1.bring up the open dialogue box (to allow the user to choose a file)
    2.save the file, with the file name determined by the text in cell A3 in .xlsx format
    I have two pieces code that seem to work individually, but not together:
    Dim strFileName As String
    strFileName = Application.GetOpenFilename
    If strFileName = "False" Then Exit Sub
    MsgBox strFileName
    ThisFile = Range("A3").Value
     ActiveWorkbook.SaveAs Filename:=ThisFile
    Thanks for the help!

    Hi
    With very little change, this works for me. I just declared your last variable. (thisFile)
    Sub test()
        Dim strFileName As String, thisFile As String
        strFileName = Application.GetOpenFilename
        If strFileName = "False" Then Exit Sub
        MsgBox strFileName
        thisFile = Range("A3").Value
        ActiveWorkbook.SaveAs Filename:=thisFile
    End Sub
    Cimjet

  • Memory usage of excel stays high after Macro is executed and excel crashes after trying to close it

    Hi,
    I'm trying to resolve an issue with an excel based tool. The macros retrieve data from an Oracle database and do calculations with the data. They also open and write into files in the same directory. The macros all run and finish the calculations. I can
    continue to use and modify the sheet. I can also close the workbook, however excel memory usage I see in the windows Task manager stays elevated.If I  close Excel it says: Excel stopped working and then it tries to recover information...
    I assume something in the macro did not finish properly and memory was not released. I would like to check what is still open (connection, stream or any other object) when I close the workbook I would like to have a list of all still used memory. Is there
    a possibility to do so.
    Here the code I'm using, its reduced to functions which open something. Functions   
    get_v_tools() and get_change_tools() are same as get_client_positions().
    Public conODBC As New ADODB.Connection
    Public myPath As String
    Sub get_positions()
    Dim Src As range, dst As range
    Dim lastRow As Integer
    Dim myPath As String
    lastRow = Sheets("SQL_DATA").Cells(Sheets("SQL_DATA").rows.Count, "A").End(xlUp).Row
    Sheets("SQL_DATA").range("A2:AD" & lastRow + 1).ClearContents
    Sheets("SQL_DATA").range("AG2:BE" & lastRow + 2).ClearContents
    Sheets("SQL_DATA").range("AE3:AF" & lastRow + 2).ClearContents
    k = Sheets("ToolsList").Cells(Sheets("ToolsList").rows.Count, "A").End(xlUp).Row + 1
    Sheets("ToolsList").range("A2:M" & k).ClearContents
    'open connection
    Call open_connection
    lastRow = Sheets("SQL_DATA").Cells(Sheets("SQL_DATA").rows.Count, "A").End(xlUp).Row
    If lastRow < 2 Then GoTo ErrorHandling
    'copy bs price check multiplications
    Set Src = Sheets("SQL_DATA").range("AE2:AF2")
    Set dst = Worksheets("SQL_DATA").range("AE2").Resize(lastRow - 1, Src.columns.Count)
    dst.Formula = Src.Formula
    On Error GoTo ErrorHandling
    'new prices are calculated
    newPrice_calculate (lastRow)
    Calculate
    myPath = ThisWorkbook.Path
    'Refresh pivot table in Position Manager
    Sheets("Position Manager").PivotTables("PivotTable3").ChangePivotCache ActiveWorkbook. _
    PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    myPath & "\[Position_Manager_v1.0.xlsm]SQL_DATA!R1C2:R" & lastRow & "C31" _
    , Version:=xlPivotTableVersion14)
    ErrorHandling:
    Set Src = Nothing
    Set dst = Nothing
    If conODBC.State <> 0 Then
    conODBC.Close
    End If
    End Sub
    Sub open_connection()
    Dim sql_data, sql_data_change, sql_data_v As Variant
    Dim wdth, TotalColumns, startRow As Integer
    Dim rst As New ADODB.Recordset
    Errorcode = 0
    On Error GoTo ErrorHandling
    Errorcode = 1
    With conODBC
    .Provider = "OraOLEDB.Oracle.1"
    .ConnectionString = "Password=" & pswrd & "; Persist Security Info=True;User ID= " & UserName & "; Data Source=" & DataSource
    .CursorLocation = adUseClient
    .Open
    .CommandTimeout = 300
    End With
    startRow = Sheets("SQL_DATA").Cells(Sheets("SQL_DATA").rows.Count, "A").End(xlUp).Row + 1
    sql_data = get_client_positions(conODBC, rst)
    wdth = UBound(sql_data, 1)
    Sheets("SQL_DATA").range("A" & startRow & ":AA" & wdth + startRow - 1).Value = sql_data
    'Run change tools instruments
    startRow = Sheets("ToolsList").Cells(Sheets("ToolsList").rows.Count, "A").End(xlUp).Row + 1
    sql_data_change = get_change_tools(conODBC, rst)
    wdth = UBound(sql_data_change, 1)
    Sheets("ToolsList").range("A" & startRow & ":M" & wdth + startRow - 1).Value _
    = sql_data_change
    'open SQL for V tools instruments
    startRow = Sheets("ToolsList").Cells(Sheets("ToolsList").rows.Count, "A").End(xlUp).Row + 1
    sql_data_v = get_v_tools(conODBC, rst)
    wdth = UBound(sql_data_v, 1)
    Sheets("ToolsList").range("A" & startRow & ":L" & startRow + wdth - 1).Value = sql_data_v
    conODBC.Close
    ErrorHandling:
    If rst.State <> 0 Then
    rst.Close
    End If
    Set rst = Nothing
    End Sub
    Private Function get_client_positions(conODBC As ADODB.Connection, rst_posi As ADODB.Recordset) As Variant
    Dim sql_data As Variant
    Dim objCommand As ADODB.Command
    Dim sql As String
    Dim records, TotalColumns As Integer
    On Error GoTo ErrorHandling
    Set objCommand = New ADODB.Command
    sql = read_sql()
    With objCommand
    .ActiveConnection = conODBC 'connection for the commands
    .CommandType = adCmdText
    .CommandText = sql 'Sql statement from the function
    .Prepared = True
    .CommandTimeout = 600
    End With
    Set rst_posi = objCommand.Execute
    TotalColumns = rst_posi.Fields.Count
    records = rst_posi.RecordCount
    ReDim sql_data(1 To records, 1 To TotalColumns)
    If TotalColumns = 0 Or records = 0 Then GoTo ErrorHandling
    If TotalColumns <> 27 Then GoTo ErrorHandling
    If rst_posi.EOF Then GoTo ErrorHandling
    l = 1
    Do While Not rst_posi.EOF
    For i = 0 To TotalColumns - 1
    sql_data(l, i + 1) = rst_posi.Fields(i)
    Next i
    l = l + 1
    rst_posi.MoveNext
    Loop
    ErrorHandling:
    rst_posi.Close
    Set rst_posi = Nothing
    Set objCommand = Nothing
    get_client_positions = sql_data
    End Function
    Private Function read_sql() As String
    Dim sqlFile As String, sqlQuery, Line As String
    Dim query_dt As String, client As String, account As String
    Dim GRP_ID, GRP_SPLIT_ID As String
    Dim fso, stream As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    client = Worksheets("Cover").range("C9").Value
    query_dt = Sheets("Cover").range("C7").Value
    GRP_ID = Sheets("Cover").range("C3").Value
    GRP_SPLIT_ID = Sheets("Cover").range("C5").Value
    account = Sheets("Cover").range("C11").Value
    sqlFile = Sheets("Cover").range("C15").Value
    Open sqlFile For Input As #1
    Do Until EOF(1)
    Line Input #1, Line
    sqlQuery = sqlQuery & vbCrLf & Line
    Loop
    Close
    ' Replace placeholders in the SQL
    sqlQuery = Replace(sqlQuery, "myClent", client)
    sqlQuery = Replace(sqlQuery, "01/01/9999", query_dt)
    sqlQuery = Replace(sqlQuery, "54747743", GRP_ID)
    If GRP_SPLIT_ID <> "" Then
    sqlQuery = Replace(sqlQuery, "7754843", GRP_SPLIT_ID)
    Else
    sqlQuery = Replace(sqlQuery, "AND POS.GRP_SPLIT_ID = 7754843", "")
    End If
    If account = "ZZ" Then
    sqlQuery = Replace(sqlQuery, "AND AC.ACCNT_NAME = 'ZZ'", "")
    Else
    sqlQuery = Replace(sqlQuery, "ZZ", account)
    End If
    ' Create a TextStream to check SQL Query
    sql = sqlQuery
    myPath = ThisWorkbook.Path
    Set stream = fso.CreateTextFile(myPath & "\SQL\LastQuery.txt", True)
    stream.Write sql
    stream.Close
    Set fso = Nothing
    Set stream = Nothing
    read_sql = sqlQuery
    End Function

    Thanks Starain,
    that's what I did the last days and found that the problem is in the
    newPrice_calculate (lastRow)
    function. This function retrieves data (sets it as arrays) which was correctly pasted into the sheet, loops through all rows and does math/calendar calculations with cell values using an Add-In("Quantlib")
    Public errorMessage as String
    Sub newPrice_calculate(lastRow)
    Dim Type() As Variant
    Dim Id() As Variant
    Dim Price() As Variant
    Dim daysTo() As Variant
    Dim fx() As Variant
    Dim interest() As Variant
    Dim ObjCalend as Variant
    Dim newPrice as Variant
    On Error GoTo Catch
    interest = Sheets("SQL_DATA").range("V2:V" & lastRow).Value
    Type = Sheets("SQL_DATA").range("L2:L" & lastRow).Value Id = Sheets("SQL_DATA").range("M2:M" & lastRow).Value Price = Sheets("SQL_DATA").range("T2:T" & lastRow).Value
    daysTo = Sheets("SQL_DATA").range("K2:K" & lastRow).Value
    fx = Sheets("SQL_DATA").range("U2:U" & lastRow).Value
    qlError = 1
    For i = 2 To lastRow
    If (i, 1) = "LG" Then
    'set something - nothing spectacular like
    interest(i, 1) = 0
    daysTo(i , 1) = 0
    Else
    adjTime = Sqr(daysTo(i, 1) / 365)
    ObjCalend(i,1) =Application.Run("qlCalendarHolidaysList", _
    "CalObj", ... , .... other input parameters)
    If IsError(ObjCalend(i,1)) Then GoTo Catch
    'other calendar calcs
    newPrice(i,1) = Application.Run( 'quantLib calcs)
    End If
    Catch:
    Select Case qlError
    Case 1
    errorMessage = errorMessage & " QuantLibXL Cal Error at: " & i & " " & vbNewLine & Err.Description
    ObjCalend(i,1) (i, 1) = "N/A"
    End Select
    Next i
    Sheets("SQL_DATA").range("AB2:AB" & lastRow).Value = newPrice
    'Sheets("SQL_DATA").range("AA2:AA" & lastRow).Value = daysTo
    ' erase and set to nothing all arrays and objects
    Erase Type
    Erase id
    Erase Price
    Set newPrice = Nothing
    Is there a possibility to clean everything in:
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    End Sub
    Thanks in advance
    Mark

  • Help needed in Macro

    Hello Experts,
    I am creating a macro, where the requirement is; user would select few columns of a KF & hit on a macro.
    The values in the KF should get multiplied by 2.
    Any clue how should I add ( *2) functionality in operation / function ?. Any other suggestion is welcomed.
    Please help
    Regards
    Rahul Chitte

    Hi Rahul,
    You can set the macro to run for few period.
    1)  In the step of the macro, select the period you want to run
    2) Within the step, Results row (Key figure row 'XXX") = Key figure row 'XXX" * 2 (remember to maintain a space between * and 2)
    3) Check the macro for any error, which would help you for any inconsistencies
    4) activate the macro to test your requirement.
    hope this would solve your requirment.
    Regards,
    Nawanit

  • Word templates with Macros

    Dear all,
    I have a couple of Word templates (in document libraries) that should have the filename and page count on the footer of the front page. It seams there is an issue with Word that these do not automatically update (MS kb 832897).
    I am using word 2010, 64 bits.
    This is solved with a Macro.
    When placing the word with macro template in SharePoint, SP blocks it and the macros are not ran.
    Any one with experience on this?
    Thanks in advance.
    Gonçalo

    It is not possible to run a macro in SharePoint after the document has been uploaded. 
    You can replicate this scenario by creating a SPItemEventReceiver which will run customized code on ItemAdded in your document library. 
    Please go through the following articles for details:
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spitemeventreceiver.aspx
    http://msdn.microsoft.com/en-us/library/office/ms437502%28v=office.14%29.aspx
    Please don't forget to mark it answered, if your problem resolved or helpful.

  • How to call HR Macros in ABAP-Webdynpro

    HI all,
    I want to extract HR data in webdynpro view.
    Where should I give Logical Database PNP?
    The ifnotypes key word is not accepting in Webdynpro coding?
    Where should I give GET PERNR event in Webdynpro?
    When I use RP_PROVIDE_FROM_LAST .... says error message
    Statement "RP_PROVIDE_FROM_LAST" is not defined. Check your spelling .
    How to use the Macros in Webdynpro (VIEW) methods.
    First time I'm working in ABAP-HR Webynpro.
    Please help me out..
    Thanks,
    Prasad

    Hi,
    How did u  solve this? pls provide the solution.
    Regards,
    Lakshmi.

  • Calling HR Macros in ABAP-Webdynpro

    HI all,
    I want to extract HR data in webdynpro view.
    Where should I give Logical Database PNP?
    The ifnotypes key word is not accepting in Webdynpro coding?
    Where should I give GET PERNR event in Webdynpro?
    When I use RP_PROVIDE_FROM_LAST .... says error message 
    Statement "RP_PROVIDE_FROM_LAST" is not defined. Check your spelling .
    How to use the Macros in Webdynpro (VIEW) methods.
    First time I'm working in ABAP-HR Webynpro.
    Please help me out..
    Thanks,
    Prasad

    Hi,
    I suspect that you are in a right forum. Please post it to appropriate forum.

  • Can I launch a Macro from an IF statement in a Bus. Rule?

    I am trying to write IF logic in a business rule to run a macro based on a Planning form-driven variable. However, my rule will not validate. For example:
    IF([variable] == 'Budget')
    %MYBUDGETMACRO(parm1, parm2, parm3);
    ELSE
    %MYOTHERMACRO (parm1, parm2, parm3);
    ENDIF
    Is it possible to do this? Thank you -

    I wrote this used-to-make-sense-but-now-just-tests-a-concept code (coming to a blog post soon, oooh, I know you can hardly wait): <--Sarcasm
    FIX("Local", [varGlblYear], [varGlblScenario], [varGlblVersion])
         /*     Call macro to do focused Aggregation     */
         "Local"
              IF(@ISMBR("Local"))
                   "Local" = #Missing ;
              ENDIF
    ENDFIX /*     FIX("Local", [varGlblYear], [varGlblScenario], [varGlblVersion])     */And it validated just fine.
    So I created a one line macro that has this code:
    "Local" = Missing ;And then called it in an IF statement:
    FIX("Local", [varGlblYear], [varGlblScenario], [varGlblVersion])
         /*     Call macro to do focused Aggregation     */
         "Local"
              IF(@ISMBR("Local"))
                   %mcrConsHBRLocalEqualsMissing()
              ENDIF
    ENDFIX /*     FIX("Local", [varGlblYear], [varGlblScenario], [varGlblVersion])     */HBR won't even let me validate it but throws an:
    Encountered " <MACRO> "%
    mcrConsHBREqualsMissing "" at line 19, column
    35
    blah
    blah
    blah
    If I get rid of the IF statement and just do this:
    FIX("Local", [varGlblYear], [varGlblScenario], [varGlblVersion])
         /*     Call macro to do focused Aggregation     */
         "Local"
              %mcrConsHBRLocalEqualsMissing()
    ENDFIX /*     FIX("Local", [varGlblYear], [varGlblScenario], [varGlblVersion])     */It still fails.
    So then I wrote this:
    FIX("Local", [varGlblYear], [varGlblScenario], [varGlblVersion])
         /*     Call macro to do focused Aggregation     */
         %mcrConsHBRLocalEqualsMissing()
    ENDFIX /*     FIX("Local", [varGlblYear], [varGlblScenario], [varGlblVersion])     */Sucess!!! Boil in bag! (That's a Network54 joke, btw.)
    So the issue isn't the IF statement, it's the calc block. You cannot insert macros into calc block statements. And since a calc block statement is required for using IF, a macro can't be used within an IF.
    Regards,
    Cameron Lackpour

  • Urgent help needed on Macros

    Hi APO Gurus...
    I want to know how to use Drill_Up and Drill_ Down macros in batch jobs. they work beautifully in interactive mode, but when processed in batch jobs they drill up only for the particular CVC's at the aggregated level specified in the job. We are  selecting all the characteristics in the aggregation level while creating the job. Then we want to drill up on particular characteristic. We are using a collective macro with first macto for drill up and second macro for calculations at the aggregated level. It works fine in interactive mode but drill_up doesnt seem to work in batch jobs.
    Help needed

    Hi,
    You should not be using DRILL_UP and DRILL_DOWN functions in background jobs. Whatever processing you need to do after DRILL_UP should be a separate macro and that should be executed in background at the desired aggregation level (set for the job).
    There is no point in using a collective macro with a DRILL_DOWN, processing and DRILL_UP steps in background job.
    Thanks,
    Somnath

  • Difference between bex user exit and macros in functionality?

    Hi all,
    I need to create a report on material master data. I created an infoset on 0material and 0mat_plant. In the requirem
    ent, I have a report containing different material numbers followed by attributes in each row. the final column in each
    row should be calculated using logic. the logic involves comparing different row values and arrive at final conclusion.
    the logic comprises of large number of if conditions. so should i use bex user exit or excel macros?
    what is the difference between user exit and macros in funcitonalilty?
    is there an issue transporting the macro to Prod for end users to use?
    any performance criteria?
    Any how to documents ..will be of a lot of help
    plz send them to [email protected]
    Message was edited by:
            ravi a

    Hi,
    Macros offer a powerful and flexible way to extend the features of MS Excel. You can either create a macro using VB code or Record a macro. Use Alt+F11 for creating macro using VB code.
    You can refer to Microsoft help site or this link for more details:
    http://www.taltech.com/support/sw_tricks/exmacros.htm
    User-exits are empty subroutines that SAP Developers have provided for you.You can fill them with your own source code.Technically this is a modification.Customer exits are nothing but a include in customer name space will be provided in the function module which starts with CALL CUSTOMER.You can fill them with your own source code.Technically this is an enhancement.
    look into following links for procedure to find and use user-exits transaction for finding user-exits is 'SMOD'
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/user_exits_tutorial.html
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

  • How to upload data from excel to SAP using VB script or Macros

    Hi Guys,
    I want to make a macro enabled Excel sheet which  i can use to upload huge data on SAP . I read some discussion but didnt get anything. Please help me with a step by step document.

    Hi,
    Please refer below link.
    Need help from Excel and SAP expert! [SOLVED]
    http://visualbasic.ittoolbox.com/groups/technical-functional/vb-vba-l/call-transaction-in-sap-from-excel-vba-macro-and-download-alv-list-object-results-to-spreadsheet-3335996
    Regards,
    Rafi

  • VB Macro in Bex Analyser is taking long time to complete execution

    Hi Experts,
    In a FI query , we have a VB macro which update the excel sheets by taking values from the previous excel sheets .
    The issue is its taking long time for query execution and if we are keep on pressing 'ENTER' button . The query is running very fastly and is giving the results ,but its not a correct way to do.
    Its a critical issue in Production and can anyone help me to resolve the issue.
    Regards,
    Anju

    Hi Anju,
    I need to create a VB macro in one of my query but i not familiar how i can plug the VB code into the query.
    Please can you give me some basic procedure on how to do that?
    What i need to do exactly is to bring a KF from a query into another query. Not sure if this is possible using VB.
    Let me know.
    Thanks.
    Cesar

  • EXCEL spreadsheet with MACROS

    WILL NUMBERS 2009 SUPPORT AN EXCEL SPREADSHEET WITH EMBEDDED MACROS?

    Looks like Excel will get macros back. This is from Wikipedia:
    Microsoft has announced that the Mac OS X version will also be released in 2010. Microsoft Office 2011 for Mac will include more robust enterprise support and greater feature parity with the Windows edition. An all-new version of Outlook with full Exchange support will return to the Mac for the first time since 2001 and replace Entourage[47], and Visual Basic for Applications (VBA, aka "macro" support) will return after being dropped in Office 2008[48][49]. There is no public beta for the Mac version,[50] however, a copy of Beta 2 (Build 14.0.0.100326) has been circulated among many Mac file sharing websites. [51]

  • Excel spreadsheets with macro's

    Good day
    Excel spreadsheets with macro's created in Windows does not work on my Macbook (excel for mac 2011), even if I enable macro's. I do not create these spreadsheets myself. Cn anyone assist please? Thank you for your time.

    Hi,
    As far as I known, the macro/Active X control can be used well with both of the Office 2013 and Office 365.
    Would you like to share us a sample file that created in Office 2013? I'd like to test it. You can send it via Email ([email protected]).
    If you have any update, please feel free let us know.
    ===========
    Update:
    I have received your mail and
    attachment. Then, I tested it, I found the probably reason.
    You were using ActiveX controls in the sample file, and them displayed 4 tabs in Format control dialog box. Next, you created a new Form control, it displayed 7 tabs.
    You were using the two type of controls. ActiveX controls and Form controls
    are different.
    Form controls
    Form controls are the original controls that are compatible with earlier versions of Excel, starting with Excel version 5.0. Form controls are also designed for use on XLM macro sheets.
    ActiveX controls
    ActiveX controls can be used on worksheet forms, with or without the use of VBA code, and on VBA UserForms. In general, use ActiveX controls when you need more flexible design requirements than those provided by Form controls. ActiveX controls have extensive
    properties that you can use to customize their appearance, behavior, fonts, and other characteristics.
    For more detail information, please refer to the following link:
    https://support.office.microsoft.com/en-us/article/Overview-of-forms-form-controls-and-ActiveX-controls-on-a-worksheet-d101804a-0f84-43ad-8cb2-e19277b8e3fb?CorrelationId=0e7129b7-8ea2-458c-af14-a99292d300b9&ui=en-US&rs=en-US&ad=US
    Hope it's helpful.
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • PowerPoint using macro to delete text boxes after printing

    Hi,
    We created custom shows in Powerpoint and are running a macro to insert temporary page numbers on the slides before printing.  The issue is that I need to remove the page numbers after printing.  I'm a novice at VBA so I'm sure there is an easy
    solution, but nothing I've tried so far has been successful.  The code is displayed below for your reference.  Any help is greatly appreciated. Thanks!
    Sub PrintCustomShow()
          ' Change this number to specify your starting slide number.
          Const lStartNum As Long = 1
          ' Ask the user which custom show they want to print.
          Dim strShowToPrint As String, strPrompt As String
          Dim strTitle As String, strDefault As String
          ' See if any custom shows are defined.
          If ActivePresentation.SlideShowSettings.NamedSlideShows.Count _
             < 1 Then
             ' No custom shows are defined.
             ' Set up the string for the message box.
             strPrompt = "You have no custom shows defined!"
             ' Display the message box and stop the macro.
             MsgBox strPrompt, vbCritical
             End
          End If
          ' Find the page number placeholder; if found, pick up the style.
          Dim rect As PageBoxSize
          Dim oPlaceHolder As Shape
          Dim bFound As Boolean: bFound = False
          For Each oPlaceHolder In _
             ActivePresentation.SlideMaster.Shapes.Placeholders
             ' Look for the slide number placeholder.
             If oPlaceHolder.PlaceholderFormat.Type = _
                ppPlaceholderSlideNumber Then
                ' Get the position of the page number placeholder.
                rect.l = oPlaceHolder.Left
                rect.t = oPlaceHolder.Top
                rect.w = oPlaceHolder.Width
                rect.h = oPlaceHolder.Height
                ' Get the formatting of the slide number placeholder.
                oPlaceHolder.PickUp
                ' Found the slide number placeholder, so set the
                ' bFound boolean to True.
                bFound = True
                Exit For
             End If
          Next oPlaceHolder
          ' See if a slide number placeholder was found.
          ' If not found, exit the macro.
          If bFound = False Then
             ' Unable to find slide number placeholder.
             MsgBox "Your master slide does not contain a slide number " _
                & "placeholder. Add a " & vbCrLf & "slide number placeholder" _
                & " and run the macro again.", vbCritical
             End
          End If
          ' Set up the string for the input box.
          strPrompt = "Type the name of the custom show you want to print." _
             & vbCrLf & vbCrLf & "Custom Show List" & vbCrLf _
             & "==============" & vbCrLf
          ' This is the title of the input box.
          strTitle = "Print Custom Show"
          ' Use the first defined show as the default.
          strDefault = _
             ActivePresentation.SlideShowSettings.NamedSlideShows(1).Name
          ' Obtain the names of all custom slide shows.
          Dim oCustomShow As NamedSlideShow
          For Each oCustomShow In _
             ActivePresentation.SlideShowSettings.NamedSlideShows
             strPrompt = strPrompt & oCustomShow.Name & vbCrLf
          Next oCustomShow
          Dim bMatch As Boolean: bMatch = False
          ' Loop until a named show is matched or user clicks Cancel.
          While (bMatch = False)
             ' Display the input box that prompts the user to type in
             ' the slide show they want to print.
             strShowToPrint = InputBox(strPrompt, strTitle, strDefault)
             ' See if user clicked Cancel.
             If strShowToPrint = "" Then
                End
             End If
             ' Make sure the return value of the input box is a valid name.
             For Each oCustomShow In _
                ActivePresentation.SlideShowSettings.NamedSlideShows
                ' See if the show is in the NamedSlideShows collection.
                If strShowToPrint = oCustomShow.Name Then
                   bMatch = True
                   ' Leave the For loop, because a match was found.
                   Exit For
                End If
                ' No match was found.
                bMatch = False
             Next oCustomShow
          Wend
          ' Get the array of slide IDs used in the show.
          Dim vShowSlideIDs As Variant
          With ActivePresentation.SlideShowSettings
              vShowSlideIDs = .NamedSlideShows(strShowToPrint).SlideIDs
          End With
          ' Loop through the slides and turn off page numbering.
          Dim vSlideID As Variant
          Dim oSlide As Slide
          Dim Info() As SlideInfo
          ' Make room in the array.
          ReDim Preserve Info(UBound(vShowSlideIDs) - 1)
          ' Save the current background printing setting and
          ' then turn background printing off.
          Dim bBackgroundPrinting As Boolean
          bBackgroundPrinting = _
             ActivePresentation.PrintOptions.PrintInBackground
          ActivePresentation.PrintOptions.PrintInBackground = msoFalse
          ' Loop through every slide in the custom show.
          Dim x As Long: x = 0
          For Each vSlideID In vShowSlideIDs
             ' The first element in the array is zero and not used.
             If vSlideID <> 0 Then
                ' Add slide ID to the array.
                Info(x).ID = CLng(vSlideID)
                ' Get a reference to the slide.
                Set oSlide = ActivePresentation.Slides.FindBySlideID(vSlideID)
                ' Store the visible state of the page number.
                Info(x).IsVisible = oSlide.HeadersFooters.SlideNumber.Visible
                ' Turn off page numbering, if needed.
                If Info(x).IsVisible = True Then
                   oSlide.HeadersFooters.SlideNumber.Visible = msoFalse
                End If
                ' Create a text box and add a temporary page number in it.
                Dim oShape As Shape
                Set oShape = _
                   oSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, _
                                            rect.l, rect.t, _
                                            rect.w, rect.h)
                ' Apply the formatting used for the slide number placeholder to
                ' the text box you just created.
                oShape.Apply
                ' Add the page number text to the text box.
                oShape.TextFrame.TextRange = CStr(x + lStartNum)
                ' Increment the array element positon.
                x = x + 1
             End If
          Next vSlideID
    ' Print the custom show. NOTE: You must turn background printing off.
                 With ActivePresentation
                 With .PrintOptions
                 .RangeType = ppPrintNamedSlideShow
                 .SlideShowName = strShowToPrint
                 End With
                 .PrintOut
                End With
          ' Restore the slide information.
          For x = 0 To UBound(Info)
             ' Get a reference to the slide.
             Set oSlide = ActivePresentation.Slides.FindBySlideID(Info(x).ID)
             oSlide.HeadersFooters.SlideNumber.Visible = Info(x).IsVisible
          Next x
          ' Restore the background printing setting.
          ActivePresentation.PrintOptions.PrintInBackground = _
             bBackgroundPrinting
       End Sub

    Hi hlolrich,
    According to the description, you want to remove the shapes which created after you print the presentaion.
    I suggest that you name the shape you added with some rule, then we can delete thease shapes via the name rule.
    And here is a sample that you delete the shapes which name contains the
    myShape words on the first slide for your reference:
    Sub deleteShapes()
    For Each aShape In Application.ActivePresentation.Slides(1).Shapes
    If InStr(aShape.Name, "myShape") Then
    aShape.Delete
    End If
    Next aShape
    End Sub
    Also you can learn more about PowerPoint developing from link below:
    How do I... (PowerPoint 2013 developer reference)
    PowerPoint 2013
    Regards & Fei
    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.

  • I am trying to use macro express and adobe acrobat 9 profession keeps shutting down, why is this happening?  I tried to run as administrator already as well on both Macro Express and in Adobe and it still keeps shutting down.

    I am trying to use macro express and adobe acrobat 9 profession keeps shutting down, why is this happening?  I tried to run as administrator already as well on both Macro Express and in Adobe and it still keeps shutting down.

    same problem, it's been happening to me for a week or two now i'm thinking about backing up my documents and just wiping it completely, see if that works. Has anyone else tried this? I'm loosing time and have already lost a good few hours of work as it just crashes randomly. need help!!!
    - saving these threads on my favourites cause i'm about to crash . . .

Maybe you are looking for

  • Why No MobileMe Albums Available to iWeb?

    Two movies and two albums clearly exist in my MobileMe Gallery; I can see them, both directly and via iPhoto. But when I move the MobileMe Gallery Widget into a webpage-in-process in iWeb '09, the pull-down menu is dimmed, saying "No Albums or Movies

  • My G4 AGP won't startup after turning on firewire target disk mode

    Can any one help me on this? I have a G4 AGP Graphics Mac running 10.4.11. I turned on firewire target disk mode in the startup utilities to transfer files to my G5. The G4 started up in Firewire just fine and I could open it up as a drive on my G5,

  • How to make something slide over automatically?

    Good example for this would be almost any online clothing store. When a new shirt gets put on the site how does one make it go to the first slot and slide the rest over or even onto the next page? Is this possible with HTML without change classes or

  • Help needed in  seprating (.)

    hi, i have one table in that i have one column. EmpName Karhitkeyan.manoharan.padmanaban. so i want to split this . and i need output like this Name1 Name2 Name3 Karhitkeyan manoharan padmanaban My table name is Emp.so pelase any one give me query fo

  • SCE reboots into recovery mode everytime

    I have a SCE1000 running 3.5.0 (or 3.1.7), and every time it reboots, it goes into recovery mode. When I connect, it prompts for the initial setup questions, and when it tries the save them, most of them fail because it is in recovery mode. Also when