I wanted convert character set on VBA.
So I coded.
'************************************************** ' ' 指定文字コードに変換した文字列を返す ' @return String ' @exception ' '************************************************** Public Function GetTextConvertedFromBinaryArrayWithSpecificCharacterSet(argExecutedPoint As String, argArrByte As Variant, argCharacterSet As String) As String Dim executedPoint As String executedPoint = argExecutedPoint & FPR_MODULE_NAME & "GetTextConvertedWithSpecificCharacterSet" On Error GoTo ERROR_STEP: '//////////////////////////////////////// specific ////////////////////////////////////////////////////////// Dim ret As String Dim objStream As New ADODB.Stream Dim hasOpened As Boolean With objStream Call .Open hasOpened = True .Type = ADODB.StreamTypeEnum.adTypeBinary .Write (argArrByte) .Position = 0 .Type = ADODB.StreamTypeEnum.adTypeText .Charset = argCharacterSet ret = .ReadText() Call .Close hasOpened = False End With Set objStream = Nothing GetTextConvertedFromBinaryArrayWithSpecificCharacterSet = ret '//////////////////////////////////////// specific ////////////////////////////////////////////////////////// Exit Function ERROR_STEP: If True = hasOpened Then objStream.Close Set objStream = Nothing End If Call ReRaiseErrorObject(executedPoint, Err) End Function
0 件のコメント:
コメントを投稿