Sub MoveMergedCells()Dim ws As WorksheetDim spillRange As RangeDim lastRow As LongDim mergedRange As RangeDim A as long Set ws = ThisWorkbook.Sheets("Sheet1") ' เปลี่ยนชื่อชีทตามต้องการ Set spillRange = ws.Range("A1").CurrentRegion ' เปลี่ยนเซลล์เริ่มต้นตามต้องการ '…
Sub RemovePasswordFromExcel()Dim excelApp As ObjectDim workbook As ObjectDim excelFilePath As StringDim password As String ' Specify the path to your Excel file and the password excelFilePath = "C:\Path\To\Your\ExcelFile.xlsx" password =…
-- Replace 'YourDatabaseName' with the name of your database-- Replace 'YourTableName' with the name of your tableUSE YourDatabaseName;GO DECLARE @TableName NVARCHAR(128) = 'YourTableName'; -- Find the SPIDs accessing the specific…
Function IsValidEmail(email As String) As BooleanDim regex As ObjectDim pattern As StringDim parts() As StringDim domainPart As String ' Initialize the regex object Set regex = CreateObject("VBScript.RegExp") ' Define the…
Public Sub DisplayTextFileNames()Dim fso As ObjectDim folder As ObjectDim file As ObjectDim folderPath As String ' Specify the path to your directory folderPath = "C:\path\to\your\directory" ' Create a FileSystemObject Set…
Public Function GetFileNameFromPath(path As String) As String Dim fileName As String fileName = Dir(path) If Len(fileName) > 0 Then GetFileNameFromPath = fileName Else GetFileNameFromPath = "File not found" End If…
Public Function DeleteFolder(ByVal folderPath As String) As Boolean On Error Resume Next Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(folderPath) Then fso.DeleteFolder folderPath, True DeleteFolder = True Else…