DP Macro- IF loops

Hi all,
I am bit bogged down by IF loop.If there are two loops in a step, for example,
IF
Condition1
Expression1
Then------
IF
Condition2
Expression2
Then-------
ENDIF
ENDIF
which loop will be executed first?
Inputs are welcome
Vard

Hi,
Thanks for the reply. My requirement is to check
IF KF1 is not fixed then enter the next IF loop, else(IF FIXED) exit the entire step.
In the next loop IF KF1=0 then write KF2 to KF1 else exit.
My macro will look like,
step1:
If
not fixed
then KF1=0
In step2 I am facing the above problem. I have to check first if KF1 is fixed, if not KF1=KF2 for all KF1 which has a value of zero(done in step1)
Inputs are welcome
Thanks

Similar Messages

  • User can only send 30 emails at a time

    Hi,
    I'm have a strange issue. We are hosting exchange and terminal server for a new customer. As part of their marketing, they send out a lot of email using the mail merge function in Word - typically they have 3-500 recipients on each list. This has been working
    without a glitch in their old environment, but after moving to our hosting environment, most of the emails gets stuck in the users outbox.
    If I open one of the messages in the outbox and click Send, it gets send immediately. After realizing this, I wrote a small macro that loops through all the items in the outbox and sends them, but when I run it, only the first 30 emails goes away. If I run
    it again immediately, nothing happens but if I wait a few minutes before running it, I can send another 30 messages.
    We are using Exchange 2010 SP1 U4 and terminal server on Win2008 R2 SP1. As far as I know, there is no setting in exchange that limits how many emails a user can send within a given period. I suspected the McAfee VSE 8.8 on the terminal server, but disabling
    it doesn't change anything.
    Any help ideas would be much appreciated!
    /Rasmus

    Hi Frank,
    The 5 users that does mail merge sending shows the same symptoms.
    Both commands return empty results:
    [PS] C:\>Get-Mailbox -organization epoka* mly | fl ThrottlingPolicy
    ThrottlingPolicy : 
    [PS] C:\>Get-ThrottlingPolicy |fl messageratelimit
    MessageRateLimit :
    Thanks,
    Rasmus

  • Problem printing static images vs camera tool snapshots

    Hi.
    This question might be a matter of formatting instead of a developer question but since it is related to some VBA code I am using I thought it would be appropriate to post here.  If it isn't, can someone let me know which forum would be more appropriate?
    Here's the situation.  I have a workbook that has many tables on separate worksheets.  Then I have couple "summary" type of worksheets which contain camera tool snapshots of tables from different worksheets for easier viewing/printing. 
    Because of the heavy lag in recalculation time created by using camera tool snapshots, I have turned the snapshots into static images by removing the source range from their formula.  Instead, after making whatever changes I need in the data, I use a
    VBA macro to loop through each snapshot and briefly restore the source range formula so that it updates to reflect the latest table changes then clear the source range formula again, returning the snapshot to a static image.  This seems to work fine when
    I view the worksheets and makes the recalculation of the tables much faster when changing the data.
    However, I have encountered a new problem.  If I print the summary worksheets with the static images, each table is printed as smaller than when they are snapshots.  In other words, when the source range formula is set to the appropriate range
    and I print the sheet, everything looks fine.  When I clear the source range formula and print the sheet, each table is now horizontally smaller and some information in the last column is being cut off.  The images/snapshots have their size set to
    100% of the original and I have tried keeping "Relative to the original" checked and unchecked with no difference.  Does anyone know why this is happening?

    It may not be the images.  It may be the print options are set to auto scale the worksheet.  Try manually printing a one test page and try different print scale options.  Use Print Preview which will allow you to scale page sizes. 
    Often issues like this occur when you are trying to print more than one page at a time.  The scale on one page may be different from a second page.  Sometimes adding page breaks (horizontal and vertical) helps solves these issues.
    jdweng

  • Edit server name in hyperlink

    Acrobat Pro XI
    We are getting a new server.  I am trying to figure out the best way to edit hyperlinks (to locations on the LAN) in existing pdf files.  Most of these files were created from Word files with links, and then converted to pdf (Acrobat Pro 7).
    Word offers ways (macros) to batch edit all of the hyperlinks in all documents in a folder, but there seems to be no built-in way to do this in Acrobat.  Assuming this is correct, Is there a way to edit all of the hyperlinks in a single pdf file in one shot (replace the server name)?  Failing that, is there a way to edit just the server name in an individual link?  I know I can "edit" a hyperlink by replacing it with a new one (drilling down to the file location each time), but I would much prefer just to replace the old server name with the new one.
    If all else fails I could create new pdf files from the Word document, but there are features of the pdf files that would need to be replicated in the new files.  For instance, there is a notice (I used a form field) that printed copies are for reference only.  There is also a process (using Java script, which I do not know, but I received help in a forum years ago) to cause the date of printing to appear in a location of my choosing.  Maybe Acrobat XI offers a way to do this, but it was inflexible and unsuitable to my needs in Acrobat 7, which is why I went the route I did.
    The point is that it would be less effort to edit the server name (if that is possible) than to create all new pdf files.  However, if I need to drill down to the file locations one at a time in the existing pdf files I would do better to start over.

    Thanks for the reply.  You confirmed what I suspected.  Links have always been clunky to manage in Acrobat.
    Related question:  The links were generated originally from Word documents that have links.  I was able to generate a list of all links used in the Word documents (I used a macro to loop through a folder and extract the links), and am now copying and pasting from that listing into the hyperlinks in the pdf file.  I use the Link tool, right click and select Properties, and edit from there.  Some of the links repeat from document to document (or within a document). There is a drop-down listing of hyperlinks added or revised in the current Acrobat session (at least), but only the leftmost characters appear in the box, often not enough to identify the link.  Is there a way to see the entire file name?

  • Update ADDRESS PURPOSE FOR SUPPLIER

    I am working in R12 EBS with oracle database 10g. I have a requirement to update the 'SUPPLIER ADDRESSBOOK DETAILS'.
    ACCOUNT PAYABLES RESPONSIBILITY--> SUPPLIER-->ENTRY-->SUPPLIER-->ADDRESS BOOK-->UPDATE ADDRESS
    Then you can update the supplier address details.This page contains two sections 'ADDRESS DETAILS' and 'CONTACT DETAILS AND PURPOSE'. In 'Contact Details and Purpose' section, *'Address Purpose' column contains 3 check boxes, named, 'purchasing','payment', and 'RFQ Only'.*
    My requirement is, i have 50 suppliers, i need to check these 3 check boxes of Address Purpose' for every supplier.
    I can't do it manually for each supplier; Could anyone suggest me the solution to update 'Address Purpose' for supplier. Is there any API or INTERFACE available?
    Any Suggestion is very helpful.
    Thanks in advance.

    Hi,
    1/Do you have only these 50 suppliers in one SOB ?
    If Yes it is very easy : you have to launch the recorder with winparrot, click on each checkbox and add in the macro a loop
    (with a :BEGIN label and the Goto(:BEGIN,1) function). You can use the IfImage() function to be sure that each checkbox is checked.
    2/If you must do it for a list of 50 suppliers (and you have more than 50 suppliers in this SOB) you must record like in 1/ and :
    List the 50 suppliers in an Excel spreadsheet 1, of the XLS file $F and use the function XlsReadData($F,1, "A"&$L) where $L is the line for each supplier name.
    (use the strings "V[F11]" and "\[CTRL]V[F11]/[CTRL]" to query in forms each supplier)
    Please let us know if you succeed or need help :-) (case 1/ or /2 ?)
    Regards
    Edited by: user12065962 on 2 févr. 2011 12:31
    Edited by: user12065962 on 2 févr. 2011 12:31

  • Force modified style be applied to previously created docx files as well

    Hi friends
    new to word.
    i have about 30 .docx documents.
    inside one of them, i selected a word which it's font is bold & is red & then i goto styles and right click on Heading1 and click on "update heading1 to match selection"
    then i right click on heading1 and selected modify and in opened box, i selected following two options.
    but the problem is , when i open any other .docx documents which i had previously created, the Heading1 style is default settings & is not what i modified, so i have to repeat modifying Heading1 style in all previously created docx files.
    any workaround?
    thanks in advanced

    You could use a Document_Open macro in the relevant template to do the updating next time the documents are opened. However, you probably wouldn't want that macro to run every time the (updated) documents are opened and it wouldn't update any that haven't
    been opened (meaning they'd still show the old Style if sent to someone whose system doesn't have your template available).
    The other option is to use a macro that loops though all the documents in one go to do the updating. The problem then becomes one of identifying which documents your template applies to, so as to not update others. If they're all in one folder, with no other
    documents, that's easy enough but, if they're scattered across multiple folders amongst many other documents, having to open & check perhaps thousands of files could take even a macro a long time to do all the processing. To get an idea of what's
    involved see, for example, the code I posted at:
    http://www.eileenslounge.com/viewtopic.php?f=26&t=14499#p107602. That macro simply updates template paths after a server change.
    Cheers
    Paul Edstein
    [MS MVP - Word]
    that's great, thanks a lot. really helped me.

  • Generate Blueprint Document

    All,
    I know how to Generate the Blueprint Document using SOLAR01. However we are using this feature more for a mass download of all documents of a certain documentation type instead of generating the actual blueprint document. Does anyone know how to get the name of the document in Solution Manager to be the name of the document that gets exported instead of the logical name. So for example:
    This is the current file name: 4695F8A00AB05599E10000003630908A.DOC but I would like it be something like 01.00.00.00 Sales Order.DOC
    Does anyone know how to do this?
    Thanks in advance.

    His problem is when the documents are downloaded to the computer for compilation into the one Blueprint document the files are given new names with a bunch of random looking characters instead of keeping the original file name.
    However, don't think it's possible without modifying Blueprint Generator or creating a custom macro that loops through all files in the Blueprint folder, opens them up, reads the name you want (which would need to be maintained in a custom property field), and renaming it.
    regards,
    Jason

  • Help writing a excel macro to do a copy of 4 cells and paste transpose. I need to loop the copy and paste through 6900 rows of data.

      I need help writing a excelmacro to do a copy of 4 cells and paste transpose.  I need to loop the copy and paste through 6900 rows of data.  I started the macro with two rounds of copying & paster transposed but I need help getting it
    to loop through all rows.  Here is what macro looks like now.
        Range("I2:I5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Range("J2").Select
        Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=True
        Range("I6:I9").Select
        Application.CutCopyMode = False
        Selection.Copy
        Range("J6").Select
        Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=True
    End Sub

    Thanks Jim for the solution above.
    Hi Brogents,
    Thanks for posting in our forum. Please note that this forum focuses on questions and feedback for Microsoft Office client. For any
    VBA/Macro related issues, I would suggest you to post in the forum of
    Excel for Developers, where you can get more experienced responses:
    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    Ethan Hua
    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.

  • Foreach Loop Teradata Macro using variable

     
    Hi All,
        I am running a Teradata Macro that I need to loop through the Foreach Loop using a variable from this loop.  I used a script task to get the variable from the object
    variable but the format is
    Example:
            "26" the macro does not recognize this the macro needs the value to be '26' or 26. 
    Can anybody tell me how i can achieved this?
    Thank you in advance!!!
    DHowe
    DHowe

    Ok i found the answer so here is the answer if anybody needs to know.
    string str =
    "0123";
    int a =
    Convert.ToInt32(str);
    Thanks,
    DHowe
    DHowe

  • Suggestion: Macros or a way to unroll loops? Integer array input? Shader Model 3 and 4?

    I think it would be nice if pixel bender supported a way to unroll loops. In it's current state certain shaders are really awkward to write or just get ugly when they're converted for flash player. I know it wouldn't be that hard for the developers to just unroll constant sized loops. Things such as:
    for (int i = 0; i < 10; ++i)
      if (foo) { ... }
    can be unrolled easily. Either that or add in some code generation feature that allows this with a preprocessor system. Or better yet add in support for loops since it only requires shader model 3 or equivelant from GLSL.
    This brings me onto another point. Is there going to be support for Shader Model 4? I'm talking about bitwise operations and integer types. Even if you don't allow native support for byte array adding texture sampling for bytes, shorts, and integers would be nice. Also allowing this to work in flash would be nice with the ability to tell the user they don't have shader model 4 or be able to detect compatability and use a different shader.
    Integer arrays would be nice to allow to as input then to the shader. I noticed the reference manual already mentioned:
    "NOTE: Pixel Bender 1.0 supports only arrays of floats, and the array size is a compile-time constant. Future versions of Pixel Bender will allow arrays to be declared with a size based on kernel parameters, which will enable parameter-dependent look-up table sizes."
    Again support for these features in flash player would be really nice.
    Targetting the lowest GPUs is really limiting the true power of pixel bender. I wrote this for fun: http://assaultwars.com/pictures/raycasting6.png which is just a simple real-time voxel raycaster. However, it could be so much more powerful if pixel bender supported more of the GPUs features. Even simple things like custom functions would be really handy in flash player. I'm thinking of this more oriented toward flash games too where more powerful features are unlocked based on the user's GPU.
    If this is already planned for a future pixel bender release then nevermind. I didn't see a developers blog or any news about future versions.
    Interesting:
    http://forums.adobe.com/thread/36659?tstart=60
    Apparently Kevin said "Look for them in a future version of the language as cards that support  these features become common." in regards to bitwise operators aka Shader Model 4.

    Here's an example, not using NetBeans:
    import javax.swing.*;
    public class TextDemo extends JPanel
        public TextDemo()
            int[] newbinarray = {0, 1, 1};
            StringBuffer sb = new StringBuffer();
            for (int value : newbinarray)
                sb.append(value);
            String st = new String(sb);
            this.add(new JTextField(st));
        private static void createAndShowGUI()
            JFrame frame = new JFrame("TextDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(new TextDemo());
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args)
            javax.swing.SwingUtilities.invokeLater(new Runnable()
                public void run()
                    createAndShowGUI();
    }

  • 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

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

  • ActiveX, Macro, calculatio​n time

    Hi,
    I do a process control simulation, where a process simulation is performed via an Excel macro while the controller and vizualization  are realized in LabVIEW:
    The control in LV generates the actuating signal, writes it to the excel sheet (via set_cell_value.vi), starts the excel simulation macro and then reads the process variables. (via get_cell_value.vi). This is repeated for every simulation step. It works fine, yet with increasing  simulation duration the time from calling the macro until completion (the calculation time)  increases: Starting with 1700 ms per cycle it comes to 5500 ms  after 500 simulatin cycles.
    Running the macro alone in a loop in excel keeps the calculation time constant at about 2000ms,however. What "piles up" when calling a macro in each simulation step ?
    Are there ActiveX parameters that must be set somehow ? 
    Attached please find  jpgs of the ActiveX macro call and the time measuring in LabVIEW and the macro  in excel (only the root).
    regards
    Uli Hoffmann 
    Attachments:
    Calling a Macro and get calc. time_090626.JPG ‏109 KB
    Carrying out the macro dynVerhalten_090626.JPG ‏137 KB

    i am not sure about what the problem could be. It could be that LV call Excel via ActiveX. Not sure though. What is the reason for using an Excel Macro insted of foing it in pure G.
    Joe.
    "NOTHING IS EVER EASY"

  • Create a Macro to Index a Word Document Line by Line

    Background
    I have collected a bunch of keywords and references to where I can find these words in a textbook.  I've put them into a Word document where each line is one Index beginning with the “Main Entry” followed by a colon and then the “Subentry”.  Note
    that in the "Subentry" I have included my reference in parenthesis (b1-m2).
    Example Original Text:
            Main Entry:Subentry (b1-m2)
    Example Marked for Index:
            Main Entry:Subentry (b1-m2){ XE "Main Entry:Subentry (b1-m2)" \t "" }
    When it was only a page of content it was no big deal to select the entire line and <Ctrl>+<Alt>+<x> then <Enter> down the line.  Now that I have about 500 lines of these word combinations, I need a more automated solution. 
    I have searched for KB articles that explain the various elements I need, though unsuccessfully since I don’t know what I need.  I doubt I am the first person to do this, so if anyone could point me to the right documents I would greatly appreciate
    it.
    As a noob, how difficult of a task is this to automate with a Macro or some other method and should I even attempt it? I have a very short window of time to figure this out.
    Nice to have: In the final index, I don't need the Word page numbering after the term.  My references are in the parenthesis.  I know how to remove it manually in Word, when I mark the index entry: Chose Options, Cross-reference
    and remove the pre-populated text of "see". That adds  \t "" to the index reference. 
    Illustrated as such:
            From: Main Entry:Subentry (b1-m2){ XE "Main Entry:Subentry (b1-m2)" }
            To:     Main Entry:Subentry (b1-m2){ XE "Main Entry:Subentry (b1-m2)" \t "" }
    My Attempt at Recording a Macro
    Having zero experience writing macro’s myself, I tried recorded a simple macro using the manual keystrokes below however the text reflected in the actual index reference does not change.  I also have to manually kick off the macro on every line of text.
    I walked through each of the steps outlined below as I was recording a macro, however when I replay the macro, the index itself contains the exact same text for every line and does not match the original text on the new line.
    I could not get the macro to repeat itself on every line.  I had to keep running it until I was done (technically, when I realized it was repeating the same text within the index reference itself) but I’d like the macro to run from beginning
    to end; line by line and then insert the Index itself at the end on a new page.
    I realize I need some kind of loop to keep the macro going line by line.
    I also need some way to mark the Main Entry within the loop (everything to the left of the colon) and then the Subentry (everything to the right of the colon to the end of the line). 
    Example “Index” Macro
    Sub Index()
    ' Index Macro
        Selection.EndKey Unit:=wdLine, Extend:=wdExtend
        ActiveWindow.ActivePane.View.ShowAll = True
        ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, Entry:= _
            "TV\:The Good Wife (y2014-y2015)", EntryAutoText:= _
            "TV\:The Good Wife (y2014-y2015)", CrossReference:="", _
            CrossReferenceAutoText:="", BookmarkName:="", Bold:=False, Italic:=False
        Selection.MoveRight Unit:=wdCharacter, Count:=1
    End Sub
    Manually Marking Index Entries
    Manually, here are the keystrokes I use to iterate my way through the document.
    Manual Index Marking Keyboard Combinations:
    At the beginning of the first line, press <Shift> + <End>
    This selects the entire rows text
    Then press <Ctrl> + <Shift> + <x>
    This allows me to “Mark Index Entry”
    Then press <Enter>
    This confirms the Index entry
    Then press <Esc>
    This closes the “Mark Index Entry”
    Go to the next line and repeat.
    Replacing anchor
    Once the creation of each index is complete, I need to be able to iterate through the document and find all anchor + colons (IE: \: ) and replace with colon (IE: :). This way, the “Main entry” and “Subentry” are handled properly when the Index is inserted.
    Manual Anchor Replacement Keyboard Combinations:
    At the beginning of the Word document, press <Ctrl> + <h>
    Find what:      \:
    Replace with:   :
    Then <Alt> + <a>
    Press the "Ok" button (or make replace silent somehow)
    Then press <Esc>
    This should close the "Find and Replace" screen
    Inserting Index
    Ideally, I would like the macro to create and insert the newly marked content into an index at the end of the document.
    Manually Inserting Index Keyboard Combinations:
    Press <Ctrl> + <End>
    this takes us to the bottom of the document
    Then press <Alt> + <s>
    this chooses the "References" tab
    Next press <Alt> + <x>
    this chooses "Insert Index"
    Next press <Alt> + <t>
    This should allow you to choose a "Format" option for the index
    Next press <m>
    This should chose "Modern" from the "Formats" options
    Finally, press <Enter>
    End the macro
    Example before Indexing:
              TV:The Good Wife (y2014-y2015)
              TV:Phineas and Ferb (y2011)
              TV:Curb Your Enthusiasm (y2011-y2015)
              Game:Back to the Future (y2012)
              Made for TV Movie:The Magic 7(y2009)
              Main Entry:Subentry (b1-m2)
    Example after Indexing is completed:
    The marked up text/references did not transfer over properly from the Word document I copied my question from.  I had to manually type the text within the {} brackets for illustrative purposes here:
              TV:The Good Wife (y2014-y2015){ XE "TV:The Good Wife (y2014-y2015)" }
              TV:Phineas and Ferb (y2011){ XE "TV:Phineas and Ferb (y2011)" }
              TV:Curb Your Enthusiasm (y2011-y2015){ XE "TV:Curb Your Enthusiasm (y2011-y2015)" }
              Game:Back to the Future (y2012){ XE "Game:Back to the Future (y2012)" }
              Made for TV Movie:The Magic 7(y2009){ XE "Made for TV Movie:The Magic 7(y2009)" }
              Main Entry:Subentry (b1-m2){ XE "Main Entry:Subentry (b1-m2)" }
    Example Index 
    G
        Game
              Back to the Future (y2012) · 2
    M
        Made for TV Movie
              The Magic 7(y2009) · 2
        Main Entry
              Subentry (b1-m2) · 1,
    2
    T
         TV
              Curb Your Enthusiasm (y2011-y2015) · 2
              Phineas and Ferb (y2011) · 2
              The Good Wife (y2014-y2015) · 2
    Chris Schurman

    Once I combined my Excel knowledge and Word knowledge, this became a piece of cake.  Sharing my solution for anyone else who may have the need.  The point of this exercise is to prepare for an open book exam and I need a quick index of my books
    (there are 6 for this class).  Anyway, here is how i solved (though slightly clunky, it works in seconds!)"
    In Excel, I pieced the text together by concatenating the indexing markup and the contents of the pertinent cells as such:
        =CONCATENATE("XE """,A2,":",B2," (b",C2,"-p",D2,")"" \t """"")
    Content from Excel (with results of concantenate statement in last column:
    Heading    Slide Title    Book    Page    Copy this into notepad then into word
    Game    Back to the Future    1    12    XE "Game:Back to the Future (b1-p12)"
    Made for TV Movie    The Magic 7    2    7    XE "Made for TV Movie:The Magic 7 (b2-p7)"
    Main Entry    Subentry    3    48    XE "Main Entry:Subentry (b3-p48)"
    TV    Curb Your Enthusiasm    4    100    XE "TV:Curb Your Enthusiasm (b4-p100)"
    TV    Phineas and Ferb    5    20    XE "TV:Phineas and Ferb (b5-p20)"
    TV    The Good Wife    6    35    XE "TV:The Good Wife (b6-p35)"
    Then I paste special the "Values" of the last column into Word.
    I run the macro below (haven't figured out how to loop yet) a few doxen times an insert the index at the bottom.
        Sub Index()
        ' Index Macro
            Selection.HomeKey Unit:=wdLine
            Selection.EndKey Unit:=wdLine, Extend:=wdExtend
            Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
            Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
                PreserveFormatting:=False
            Selection.EndKey Unit:=wdLine
            Selection.MoveRight Unit:=wdCharacter, Count:=1
        End Sub
    Bam; instant Index!
    Chris Schurman

  • How to delete empty coulums in Excel using Macro

    Dear Users,
    i have prepared a very big excel file. actually this file is record of old prices and i vlook the the part number from different files and extract the old prices. some time there is no record so all the columns is empty. let me explain little more.....i
    have excel files by year 1992 To 2013. most of the times i have to vlookup the old prices, now for exampe one item we just sale in 94,97and 2007, but except these years all the columns of other years from 92 to 2013 are empty. one by one check them top to
    end and delete is very hard. is there any macro which checks the value from top to end, if there is no value so it delete all the coulum...........hope i could explain my question.................
    Best Regards
    Tahir Mehmood

    Hi,
    Please try this code:
    Sub DeleteBlankColumns()
    Dim c As Integer
    'declare c as variable for column number
    c = ActiveSheet.Cells.SpecialCells(xlLastCell).Column
    'save last column number in used range
    Do Until c = 0
    'Loop for each column number until it equals 0
    If WorksheetFunction.CountA(Columns(c)) = 0 Then
    'Check if entire column is blank
    Columns(c).Delete
    'if column is blank delete column
    End If
    'closes if statement
    c = c - 1
    'proceeds to the next lowest column number
    Loop
    End Sub
    PS:
    This is the forum to discuss questions and feedback for Microsoft Excel, if you have further question, please post the thread to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    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.

Maybe you are looking for

  • Customer service...lack of

    I guess changes have been made in the usually great Verizon Customer Service.  I had been working with a lady from the Office of the President on some phone/service/equipment issues.   Now the numbers given to me are no longer in service or a recordi

  • How to know my dialog has changed

    I have a Jdialog componenet with various textfields,passwordfield,a few checkboxes and listboxes. I have two buttons at the bottom saying ok and cancel ok button updates the new info from the dialog and updates the database. How do i identify whether

  • VM creation from iso -issue

    Hi All, I am trying to create a virtual machine in my OVM 3.1.1 and install WIn 2008 Server there... So I uploaded iso file into my repository, created the vm but when I tried to start it I got the error saying that it failed because: stderr: Error:

  • Spacing between Words of Variables in Header

    I have spent a lot of time on this and tried everything I can think of, and I have been unable to find a similar thread on this forum. I have now given up and come here for some guidance. The template I am using is set up with A4 paper size, double-s

  • IMovie 11 - projects on multiple drives problem

    My set-up:  2007 Mac Pro, boot drive is an SSD; drive 2 is all my data (folders for Music, Movies, Documents, Photos); drive 3 is a back-up drive of drive 2; drive 4 is a back-up of the boot drive. Since the boot drive is an SSD, it has limited capac