Archive

Posts Tagged ‘MS-Excel’

Radar Chart visualizing Cost of Living in select US Cities

sperlings-costofliving-us-cities-radar-chart

Source:Sperling’s

Categories: Charts, e-commerce, Media Tags: ,

Have your VBA Add-in autogenerate menus for easier access to your macros

  1. P_20160720_203804
  2. Storing your macros in add-ins (.xlam) has many advantages over personal.xlsm and similar document locations.
  3. One disadvantage is that an Add-in macro is not accessible through the macros dialogue.
  4. The community recommends assigning shortcuts for easy access. I did that and went a couple of steps further using VBE extensibility to
    1. depending on scope
      1. public procedures on your end users’ computer to whom you distribute your Add-in
      2. and also non-private on the developer  machine
    2. list your modules alphabetically
    3. list your macros alphabetically under your modules
    4. find pick a free (within Excel –  short of windows-wide shortcuts – In my current work environment, I am unable run tools that allow you to list these shortcuts) shortcut combination and and assign it to your macro Code
  5. Code TBA

Try “Stop Collecting” with Office Clipboard for Runtime Error 1004 “Paste Method of Worksheet Failed”

There seem plenty potential sources of error for  method .Pastespecial, and  a vast amount of questions and good advice online.

But I did not find this one, and only this one managed to make Pastespecial into Excel work for me. image

PowerShell Script to convert your Testing Anywhere run logs into a Excel pivot table data source

    1. If confronted with a sizable Testing Anywhere test script codebase which has been marginally, but not substantially enhanced/cleaned up in several years while producing a barrage of automation errors daily,
    2. you may find that the run suite errors that Testing Anywhere logs automatically in its rlgx files are your best data source  for monitoring and designing a plan of attack:
      1. Any oft-failing scripts should be put last during the daily run? how about length script needs to run?
      2. Any failing  script parts could be modularized and during the daily run? rlgx-excel-pivot-scripts-avg-duration-percentage
      3. any oft-failing scripts? E.g. here the top 8% of failing scripts have almost 30% of the errors. image
      4. Any oft-failing approaches that might benefit from refactoring? Starting with which  scripts? Main actions, then sub-actions:rlgx-excel-pivot-scripts-error-type-countrlgx-excel-pivot-scripts-error-type-count
      5. etc.
    3. Then this PowerShell script may help which
      1. extracts the non binary <runlog> items out of the binary rlgx files,
      2. and merges them into a single file
      3. which it wraps with an XML declaration and root level node that Excel can work with.
 
add-content -value '' -path C:\td\testinganywhere\files\rlgx\all-a-rlgx.xml -Encoding UTF8 Get-childitem -path C:\td\testinganywhere\files\rlgx\arnold-pc1 |
? {$_.Extension -eq ".rlgx"} |  
% { $file = convertto-string $_.FullName  
$match = [regex]::Match($file,'\s+(.*)\s+',"SingleLine,IgnoreCase").value    
add-content $match -path C:\td\testinganywhere\files\rlgx\all-a-rlgx.xml -Encoding UTF8 } 
add-content '' -path C:\td\testinganywhere\files\rlgx\all-a-rlgx.xml -Encoding UTF8 
  1. Make this PowerShell script a Scheduled Task,
  2. So that you can auto-update said XML which you made the  data source for your Excel monitoring/planning work book.
    1. The post-processing of the default error log messages that makes meaningful pivoting actually possible, is left as an exercise to the reader by Testing Anywhere Smiley .

How to split an Excel workbook into one file per sheet with VBA (reworked)

  1. There are other code snippets on stackoverflow.com, but I went with the top match in the Google search.
  2. Couldn’t get it to work (error # 424 Object required on xWS.copy in Excel 2013, with the VBA run from a separate utilities workbook) until I made these changes:
'TRP reworked http://www.extendoffice.com/documents/excel/628-excel-split-workbook.html
Sub Workbook_Split() 'Updated by TRP 20150924

    Dim xPath As String
    Dim myWorkSheet As Worksheet
    xPath = Application.ActiveWorkbook.Path 'the source workbook needs be saved first
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    For Each xWS In ActiveWorkbook.Sheets    'trp: replaced ThisWorkbook.Sheets
        'trp: replaced xWS.Copy 'toask: this fails with 424: object required
        Set myWorkSheet = xWS
        myWorkSheet.Copy 'If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the copied sheet.
        Application.ActiveWorkbook.SaveAs FileName:=xPath & "\" & myWorkSheet.Name & ".xlsx" 
        'trp: replaced xWS.Name & ".xls"
        Application.ActiveWorkbook.Close False    'trp:savechanges:=False
    Next
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
End Sub

How to ease editing work in MS-Word by automating search/replace operations

  1. If you frequently have to edit documents according to a large number of editorial rules and regulations
  2. and if you can partially automate these edit operations  (or at least highlight suspicious passages for human review) with Word’s search/replace,
  3. I can recommend an add-in that can automate even the repeated search/replace operations (like the 57 in the video below)
  4. and even help you manage your search/replace strings and regular expressions in a spreadsheet which it can load from:
  5. Greg Maxey’s VBA Find & Replace Word Add-in. See it in action (click for full size):
  6. vbareplace
  7. Two Three Caveats: :
    1. At this point, I cannot get the add-in to work only in Word 2010. Even if I lower Macro security and allow programmatic access to the VBA project, when trying to launch the add-in from the ribbon, Word 2013 complains: “The macro cannot be found or has been disabled due to your macro security settings”:image.
    2. The automation is only as good as your underlying search/replace operations. (Hint: “Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems.”)
    3. I think I will refrain from search/replace during “Tracking changes” – as in the video – , and rather use “Compare documents” after the replace operations – too many quirks otherwise…

Doxygen config reformatted for Excel

  1. Apart from the almost 150 markup tags Doxygen 1.1. supports (not to mention HTML tags that are supported also),
  2. the Doxygen config file in version 1.8.8 has over 260 settings, many with complex interrelations.
  3. To facilitate working with so many options, especially when testing. I reformatted the default config file for import into Excel,
  4. where I can more easily sort, search and filter,
  5. and export columns L-R whenever I need to update the doxygen.config file: image

Below is a live, downloadable view: