March 2006

VB.net Learning Videos

The thing with MSDN it that there’s loads of good stuff on it, you just have to spend about 6 hours to get to it. So of these look good, eps. towards the bottom:

“This video series is designed specifically for individuals who are interested in learning the basics of creating applications using Visual Basic 2005 Express Edition. The series includes over 10 hours of video-based instruction that walks you through creating your first “Hello World” application to a fully functioning RSS Reader application. Learn how to write your first application today!!”

http://msdn.microsoft.com/vstudio/express/vb/learning/

New Access

Just a quicky:

http://blogs.msdn.com/access/default.aspx

MS blog about new Access if it’s as good as Dave’s Excel one, it will be fantasic!

Click to install Addin

The following code will install an addin to the users local addins folder. There are two constants that need to be changed, well only one really if your installing a .xla. You will also need to modify the call to “Addcustommenu” which appears twice – make a call to your menu/entry points code.

The code actually saves a copy of it’s self into the users adding folder, this make it good for deployment over a network.

I use this code in conjunction with some modified code from JKP apps set up utility.

[vba]Const gsAppName As String = “Your Addin Name”
Const gsFilename As String = gsAppName & “.xla”

‘—————————————————————————————
‘ Procedure : auto_open
‘ DateTime : 02/03/2006 11:17
‘ Author : rmclean
‘ Purpose : Installs Addin to local addins folder
‘ Version : v1
‘—————————————————————————————

Sub auto_open()
On Error GoTo ErrorHander

”exit if in degub mode
If Dir(ThisWorkbook.Path & “\debug.ini”) <> “” Then
Exit Sub
End If

If UCase(ThisWorkbook.FullName) = _
UCase(Application.LibraryPath & “\” & gsFilename) Then
On Error Resume Next
AddIns.Add (Application.LibraryPath & “\” & gsFilename)
AddIns(gsAppName).Installed = True
On Error GoTo ErrorHander

Call Addcustommenu ”CHANGE AS NEEDED

Exit Sub
Else
‘opens a workbook in case
Workbooks.Add
‘closes any workbook with the same name
On Error Resume Next
Workbooks(gsFilename).Close False
On Error GoTo ErrorHander

ThisWorkbook.SaveAs Filename:=Application.LibraryPath & “\” & gsFilename _
, FileFormat:=xlAddIn
AddIns.Add (Application.LibraryPath & “\” & gsFilename)
AddIns(gsAppName).Installed = True
End If

Call Addcustommenu ”CHANGE AS NEEDED

Exit Sub

ErrorHander:
MsgBox “An error ‘appen, when i wrote this code I didn’t thing this would happen. The error was: ” _
& vbNewLine & vbNewLine _
& Err.Description & vbNewLine & vbNewLine _
& “Can you tell Ross Mclean about this. thanks”, Title:=gsAppName, Buttons:=vbOKOnly

End Sub
[/vba]