//返値 : true:オープンされている。false:オープンされていない。
bool IsOpenExcel(LPCTSTR szFileName)
{
HANDLE hf;
hf = CreateFile(szFileName,GENERIC_READ,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
if (hf != INVALID_HANDLE_VALUE)
{
CloseHandle(hf);
return false;
}
return true;
}
2012年11月16日金曜日
VC++にてOLE経由でExcel操作時のエラー
VC++2008にてOLE経由でExcelを操作中に、Excel側で印刷を行うと、以下のエラーダイアログが表示される。(プレビュー表示でも発生)
なお、この際、印刷自体はそのまま正しく実行される。
Microsoft Visual C++ Runtime Library
Runtime Error!
Program:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
なお、この際、印刷自体はそのまま正しく実行される。
Microsoft Visual C++ Runtime Library
Runtime Error!
Program:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
2007年9月27日木曜日
Excelにてカタカナを全角、英数記号を半角に変換する。
'rwmin : 開始行
'rwmax : 終了行
'col : 列番号
Sub change(rwstart as integer,rwend as integer,col as integer)
Dim i As Integer
Dim j As Integer
Dim result As String
Dim temp As String
For i = rwstart To rwend
result = ""
For j = 1 To Len(Cells(i, col))
temp = Mid(Cells(i, col), j, 1)
temp = StrConv(temp, vbNarrow)
If (Asc(temp) >= &HA6) And (Asc(temp) <= &HDF) Then
temp = StrConv(temp, vbWide)
End If
result = result + temp
Next j
Cells(i, col) = result
Next i
End Sub
登録:
投稿 (Atom)