I don’t really know anything about Analysis Services, but MS have just pushed out some addins for leverageing this part of SQL2005 from Excel 2007 – Thought this might be useful to some folks (I’m thinking of Will!)
Tag: Data
Data Encryption Workbook
I’ve just made this easy to use data encryption tool. The encryption algorithm is taken from Rob Bovey’s site.
You can drop your data on to the worksheet (you can add extra worksheets too if you like) and then encrypt the data with the press of a button. You will be asked to provide a key, which you must remember. Save the file and send it out.
The receiver can then contact you for the key. When they click the decrypt button it will ask them for the key, if they enter it correctly it will return the original data. If they enter the wrong key the data will be encrypted again.
I have not tested this much, so make sure you back up your originals and remember there is not such thing a truly save data!
If you have any questions or suggestions drop me a comment.
Enjoy!
Selection to CSV
Obviously you could adapter it to do what ever type of text file you like (well, and Excel can handle)
[vba]
Option Explicit
Private Const BIF_RETURNONLYFSDIRS As Long = &H1
Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2
Private Const BIF_RETURNFSANCESTORS As Long = &H8
Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000
Private Const BIF_BROWSEFORPRINTER As Long = &H2000
Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000
Private Const MAX_PATH As Long = 260
Type BrowseInfo
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszINSTRUCTIONS As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Boolean
hNameMappings As Long
lpszProgressTitle As String
End Type
Declare Function SHGetPathFromIDListA Lib “shell32.dll” ( _
ByVal pidl As Long, _
ByVal pszBuffer As String) As Long
Declare Function SHBrowseForFolderA Lib “shell32.dll” ( _
lpBrowseInfo As BrowseInfo) As Long
Public Sub Save_To_Where()
Dim sFolderName As String
Dim sFileName As String
Dim sdefult As String
sdefult = “M.I.E Export to CSV – ” & Application.UserName & ” – ” _
& Round((Timer), 0)
sFolderName = BrowseFolder(“Save Text File Where?”)
If sFolderName = “” Then
Exit Sub
Else
sFileName = InputBox(“Entre the file name you would like to use”, “File Name”, sdefult)
If Len(sFileName) = 0 Then
Exit Sub
End If
End If
SaveAsText sFolderName, sFileName
End Sub
”’Fuction to get directory
Function BrowseFolder(Optional Caption As String = “”) As String
Dim BrowseInfo As BrowseInfo
Dim FolderName As String
Dim ID As Long
Dim Res As Long
With BrowseInfo
.hOwner = 0
.pidlRoot = 0
.pszDisplayName = String$(MAX_PATH, vbNullChar)
.lpszINSTRUCTIONS = Caption
.ulFlags = BIF_RETURNONLYFSDIRS
.lpfn = 0
End With
FolderName = String$(MAX_PATH, vbNullChar)
ID = SHBrowseForFolderA(BrowseInfo)
If ID Then
Res = SHGetPathFromIDListA(ID, FolderName)
If Res Then
BrowseFolder = Left$(FolderName, InStr(FolderName, _
vbNullChar) – 1)
End If
End If
End Function
Public Sub SaveAsText(sFolder As String, sName As String)
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
Selection.Copy
Workbooks.Add
ActiveWorkbook.Sheets(1).Paste
ActiveWorkbook.SaveAs Filename:=sFolder & “\” & sName & “.csv”, FileFormat:=xlCSVMSDOS
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Exit Sub
”’Error handerling
ErrorHandler:
If Err.Number = 1003 Then
MsgBox “Error, did you use <, >,?,[,], :, | or *” _
& vbNewLine & “Make sure the folder exists” _
& vbNewLine & “Make sure the ile/path name is not onger than 218 letters” _
& vbNewLine & “Make sure the folder is not read only”, _
vbOKOnly, “Error Exporting Text File”
Exit Sub
Else
MsgBox “An unexpected error occured, export aborted”, vbOKOnly, “Error Exporting Text File”
Exit Sub
End If
End Sub
[/vba]
Opening Access Tables Directly in Excel
Maybe I’ve missed the boat on this one but I never knew you could open an Access table directly inside excel, I’ve always exported them to .xls files in Access, or used Get Extrenal Data. In Excel, file open (pick all from the type drop down) and click on the Access DB, give you this:

Cliciking the table will import it into excel – i guess it errors out when you go over 65537!