Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mettere bordi a range celle excel da vba

421 views
Skip to first unread message

mario rossi

unread,
Mar 2, 2023, 4:10:05 AM3/2/23
to
buongiorno a tutti, con il codice qui sotto apro un file di excel e compilo alcune celle e fin qui tutto ok, non trovo come settare un bordo ad un range di celle
esempio: impostare un bordo al range (A2:C7) qualcuno sa come fare?
Grazie.

Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object

'Start a new workbook in Excel
Set oExcel = CreateObject("Excel.Application")

Set oBook = oExcel.Workbooks.Open(file1)

'Add data to cells of the first worksheet in the new workbook
Set oSheet = oBook.Worksheets(1)

oSheet.Range("a2").Value = "pippo srl"
oSheet.Range("a3").Value = "via roma 32 12345 Roma"
oSheet.Range("a4").Value = "32455555555"

'Save the Workbook and Quit Excel
oBook.Save
oExcel.Quit
Set oSheet = Nothing
Set oExcel = Nothing
Set oBook = Nothing




BFS

unread,
Mar 2, 2023, 5:48:57 AM3/2/23
to
oSheet.Range("A2:C7").Borders.Weight = 2

BFS


mario rossi

unread,
Mar 2, 2023, 8:05:42 AM3/2/23
to
danke!

mario rossi

unread,
Mar 2, 2023, 9:15:52 AM3/2/23
to
Il giorno giovedì 2 marzo 2023 alle 11:48:57 UTC+1 BFS ha scritto:
Sai anche come posso mettere quel bordo solo sopra o sotto o destra o sinistra?
Non trovo la proprietà

mario rossi

unread,
Mar 2, 2023, 9:36:19 AM3/2/23
to
trovato

oSheet.Range("A8:C7").Borders.Item(xlEdgeBottom).LineStyle = -4119
oSheet.Range("A8:C7").Borders.Item(xlEdgeBottom).colorindex = 3

0 new messages