|
- '--------------------------------------------------'
- ' Das Excel-VBA-Codebook 2007 '
- ' Alle Rechte vorbehalten '
- ' Melanie Breden und Michael Schwimmer '
- '--------------------------------------------------'
- Option Explicit
- Public Sub GetxlbPath()
- Dim strFile As String
- Dim strPath As String
-
- ' Excel-Version ermitteln
- Select Case Val(Application.Version)
- Case 9
- strFile = "Excel"
- Case 10
- strFile = "Excel10"
- Case 11
- strFile = "Excel11"
- Case 12
- strFile = "Excel12"
- Case Else
- MsgBox "Die Excel-Version konnte nicht identifiziert" & _
- "werden." & vbNewLine & _
- "Die Prozedur wird beendet.", _
- vbExclamation
- Exit Sub
- End Select
-
- ' Speicherpfad ermitteln
- strPath = Environ("APPDATA") & "\Microsoft\Excel"
-
- MsgBox "Die Befehlsleistendatei befindet sich im Ordner:" & _
- vbNewLine & vbNewLine & _
- strPath, _
- vbInformation, _
- "Speicherpfad " & strFile & ".xlb"
-
- ' Hyperlink in Zelle erstellen
- With ActiveSheet
- .Range("C5").Hyperlinks.Add _
- Anchor:=.Range("C5"), _
- Address:=strPath, _
- TextToDisplay:=strFile & ".xlb"
- End With
- End Sub
复制代码 |
|