I'm normally not into Office Automation but today I needed to extract all embedded files from a Word Document. Those files were Word, Excel and PDF documents. Luckily the majority were Word documents, because the quick solution I whipped up only works for those types, not for Excel or PDF.
Here's the VBA script that loops through the embedded objects, checks if it's a Word document and goes to save it in a new folder.
' ExtractFiles Macro
Dim shape As InlineShape
Dim folderName As String
Dim a As Document
folderName = Replace(ThisDocument.Name, ".", "_")
For Each shape In ThisDocument.InlineShapes
If (shape.Type = wdInlineShapeEmbeddedOLEObject) And (InStr(LCase(shape.OLEFormat.IconLabel), ".doc") > 0) Then
shape.OLEFormat.Object.SaveAs (folderName & "\" & shape.OLEFormat.IconLabel)
Today I got into testing how to filter a list with a multivalued Choice (or Lookup) column based on a multivalued filter. The setup I'm using is to connect a Choice Filter Web Part with the List View Web Part.
Once you have configured the Filter Web Part and connected it to the List View Web Part the fun starts. Just take a look at the following result rest:
... and compare it with this one:
The only difference here is the order of the filter values. But the result set shouldn't be different, should it? What's the logic behind it? Does it merge result sets of individual filter values? Confusing indeed... It does do something 'special' with the first filter value.
note: If you want to change the order of the filter values you can do so by selecting them one at a time: Cat2 > OK > Cat1 > OK
note2: It also works without the 'OK' step :)
Here's an overview (just as a reference really):
|Cat1; Cat2; Cat3
|Cat1; Cat3; Cat2
|Cat2; Cat1; Cat3
|Cat2; Cat3; Cat1
|Cat3; Cat1; Cat2
|Cat3; Cat2; Cat1
I think it's safe to say this isn't really a reliable scenario. A better way of filtering can be achieved using the Query String:
This is the same mechanism as if you would click on a filterable column and specify a value there. Only doesn't it allow you to select multiple values.
This works like an AND filter. There seems to be no way in making it behave like an OR filter, but so be it. It is still way more reliable than usin the Choice Filter Web Part.
note: If you're not doing multivalued filtering both methods are equally reliable !