von turtle47 » Mi, 11.02.2009 10:18
Hi Clac,
in meiner Grabbelkiste hatte ich noch ein Makro liegen zum Formatieren von Mailadressen.
Ich habe es mal auf URL-Links angepasst.
Vielleicht kannst Du ja was damit anfangen.
Zelle(n) markieren und Makro drüberlaufen lassen.
Code: Alles auswählen
Sub Start_Hyperlink_Format
oDoc = ThisComponent
If Not oDoc.supportsService _
("com.sun.star.sheet.SpreadsheetDocument" ) then
MsgBox "Das ist ein kein Calc-Dokument! Die Anwendung kann deshalb nicht ausgeführt werden! " , 16 , "Format Hyperlink"
Exit Sub
end if
if End_Row > 65534 then
msgbox "Ganze Spalten markieren ist nicht möglich!" & CHR(13) & "Der Vorgang wird jetzt abgebrochen!",,"Format Hyperlink"
end if
oSheet = ThisComponent.CurrentController.getActiveSheet()
oZell = oDoc.getCurrentSelection()
oZell.supportsService("com.sun.star.sheet.SheetCellRange")
oSelect=ThisComponent.CurrentSelection.getRangeAddress
oSelectColumn=ThisComponent.CurrentSelection.Columns
oSelectRow=ThisComponent.CurrentSelection.Rows
CountColumn=oSelectColumn.getCount
CountRow=oSelectRow.getCount
Start_Column=oSelect.StartColumn
End_Column=oSelect.EndColumn
Start_Row =oSelect.StartRow
End_Row=oSelect.EndRow
if End_Row > 65534 then
msgbox "Ganze Spalten markieren ist nicht möglich!" & CHR(13) & "Der Vorgang wird jetzt abgebrochen!",,"Format Hyperlink"
exit sub
end if
For sp = Start_Column to End_Column
For ze = Start_Row to End_Row
oCell = oSheet.getCellByPosition(sp,ze)
sLink = oCell.String
if sLink = "" then
end if
sFile = ConverttoURL(sLink)
oCell.formula = "=Hyperlink(" & """"& sFile & """" & ";" & """"& sLink & """" & ")"
'oCell.charcolor=RGB (0, 0, 0) 'Schriftfarbe
'oCell.CellBackcolor = RGB (192, 192, 192)'Zellfarbe
next ze
next sp
msgbox "Die Formatierung ist abgeschlossen." ,64 , "Format Hyperlink"
End Sub
Viel Erfolg.
Jürgen
Hi Clac,
in meiner Grabbelkiste hatte ich noch ein Makro liegen zum Formatieren von Mailadressen.
Ich habe es mal auf URL-Links angepasst.
Vielleicht kannst Du ja was damit anfangen.
Zelle(n) markieren und Makro drüberlaufen lassen.
[code]Sub Start_Hyperlink_Format
oDoc = ThisComponent
If Not oDoc.supportsService _
("com.sun.star.sheet.SpreadsheetDocument" ) then
MsgBox "Das ist ein kein Calc-Dokument! Die Anwendung kann deshalb nicht ausgeführt werden! " , 16 , "Format Hyperlink"
Exit Sub
end if
if End_Row > 65534 then
msgbox "Ganze Spalten markieren ist nicht möglich!" & CHR(13) & "Der Vorgang wird jetzt abgebrochen!",,"Format Hyperlink"
end if
oSheet = ThisComponent.CurrentController.getActiveSheet()
oZell = oDoc.getCurrentSelection()
oZell.supportsService("com.sun.star.sheet.SheetCellRange")
oSelect=ThisComponent.CurrentSelection.getRangeAddress
oSelectColumn=ThisComponent.CurrentSelection.Columns
oSelectRow=ThisComponent.CurrentSelection.Rows
CountColumn=oSelectColumn.getCount
CountRow=oSelectRow.getCount
Start_Column=oSelect.StartColumn
End_Column=oSelect.EndColumn
Start_Row =oSelect.StartRow
End_Row=oSelect.EndRow
if End_Row > 65534 then
msgbox "Ganze Spalten markieren ist nicht möglich!" & CHR(13) & "Der Vorgang wird jetzt abgebrochen!",,"Format Hyperlink"
exit sub
end if
For sp = Start_Column to End_Column
For ze = Start_Row to End_Row
oCell = oSheet.getCellByPosition(sp,ze)
sLink = oCell.String
if sLink = "" then
end if
sFile = ConverttoURL(sLink)
oCell.formula = "=Hyperlink(" & """"& sFile & """" & ";" & """"& sLink & """" & ")"
'oCell.charcolor=RGB (0, 0, 0) 'Schriftfarbe
'oCell.CellBackcolor = RGB (192, 192, 192)'Zellfarbe
next ze
next sp
msgbox "Die Formatierung ist abgeschlossen." ,64 , "Format Hyperlink"
End Sub
[/code]
Viel Erfolg.
Jürgen