2021-01-01から1年間の記事一覧
面白そうだったのでチャレンジしてみました。暇なVBAerに課題置いておきます。a列のファイル名を、ランダムに並び替えた結果をb列に出力した後、aからbのファイル名に一括変更するマクロを書いてみてください。さらに、変更後にミスを発見したときの為に、元…
Public Sub 文字列を抽出する() Dim txt As String Dim r As Long Dim lngRGB As Long r = 1 txt = "" Do txt = txt & decodeChar(Cells(r, 1).Font.Color) txt = txt & decodeChar(Cells(r, 1).Interior.Color) r = r + 1 Loop Until Cells(r, 1).Font.Colo…
Option Explicit Public Sub 文字列を埋め込む() Dim txt As String Dim ch As String Dim i As Long, r As Long Dim lngR As Long, lngG As Long, lngB As Long Dim sw As Long Dim ascCode As Long txt = "Hello" & vbNewLine & "World !" r = 1 Columns(1…
Option Explicit Public Sub 読み込んだ2進数を文字列に変換() Dim filePath As String Dim fileNo As Long Dim txt As String Dim txts() As String Dim i As Long filePath = ThisWorkbook.Path & "\binary.dat" fileNo = FreeFile Open filePath For Inpu…
Option Explicit Public Sub 文字列を2進数に変換して保存() Dim filePath As String Dim fileNo As Long Dim txt As String txt = "userid" & vbCrLf & "password" txt = encode(txt) filePath = ThisWorkbook.Path & "\binary.dat" fileNo = FreeFile Open…
Option Explicit 'セルに表示させるときは一文字目が = だと 'エラーになるので注意 Public Sub パスワード生成() Debug.Print createPassword(8) End Sub Private Function createPassword(ByRef pwLength As Long) As String Dim asciiCode As Long Dim pw…
Option Explicit Public Sub ハッシュ値取得() Dim pw As String Dim hash As String Dim filePath As String Dim fso As Object Range("B1").Clear pw = Range("A1").Value If pw = "" Then Exit Sub End If 'パスワードを書き込んだテキストファイルを生成…