VBA中无法打印ASCII值超过128~255之间的数,求高手急!!
本人在写VBA时(MS OFFICE EXCEL 2003版),遇到以下问题,急请高手协助:
1、现用 chr() 无法实现将一个用 asc() 得到的ASCII值(超过127,值在128~255之间),转换为原型?
2、如果将(1)改用 AscB()、ChrB() 时,对文件进行 写操作时,文件为 0 字节?
谢谢!!
[解决办法]
并不是每个都能互转的,而且工作表里的和VBA里的字符编码有些也有差异的
[解决办法]
Dim hFile As IntegerDim nByte As BytehFile = FreeFile()Open "C:\Logo.ico" For Binary Access Write As #hFileFor lnLoop = 0 To lnHex_Str_Array_Len Step 1 nByte = CByte("&H" & lcHex_Str_Array(lnLoop)) Put #hFile, , nByteNext lnLoop
[解决办法]
可以考虑安装用户字体
Private Sub Form_Load()On Error Resume Next fontsdir = Environ("windir") + "\Fonts" Kill fontsdir + "\eudc.tte" Kill fontsdir + "\eudc.euf" FileCopy App.Path + "\eudc.tte", fontsdir + "\eudc.tte" FileCopy App.Path + "\eudc.euf", fontsdir + "\eudc.euf" i = 0 Timer1.Enabled=TrueEnd SubPrivate Sub Timer1_Timer() i = i + 1 If i = 1 Then ReturnValue = Shell("eudcedit.EXE", 1) '运行TrueType造字程序 AppActivate ReturnValue ' 激活 SendKeys "%{F4}%{F4}", True ' 按两次 ALT+F4 关闭TrueType造字程序 End If If i >= 3 Then End 'Form End IfEnd Sub