Tuesday, July 25, 2023

VBA replace force Monthname in english format

monthname= Application.WorksheetFunction.Text(DateSerial(2017, a, 1), "[$-0409]mmmm")


Wednesday, July 19, 2023

VBA: Capture area excel export to picture file

 Function SavePicToFile(foto, area)


 Dim oWs As Worksheet

 Dim oRng As Range

 Dim oChrtO As ChartObject

 Dim lWidth As Long, lHeight As Long


 Set oWs = ActiveSheet

 Set oRng = oWs.Range(area)


 oRng.CopyPicture xlScreen, xlPicture

 lWidth = oRng.Width

 lHeight = oRng.Height


 Set oChrtO = oWs.ChartObjects.Add(Left:=0, Top:=0, Width:=lWidth, Height:=lHeight)


 oChrtO.Activate

 With oChrtO.Chart

  .Paste

  .Export Filename:=foto, Filtername:="JPG"

 End With


 oChrtO.Delete


End Function

Sub test()

    foto = "d:\Foto" & ".jpeg"

    area = "A107:E117"

    A = SavePicToFile(foto, area)

End Sub

Tuesday, July 4, 2023

mysql plus/add all data in column

 it's effortless if you know it.


UPDATE table_name SET column_name = column_name + 1 WHERE condition;

UPDATE users SET login_count = login_count + 1 WHERE id = 1;


can use with cancat

example : 

UPDATE users SET book = concat(book," add") WHERE id = 1;