ラベル Excel の投稿を表示しています。 すべての投稿を表示
ラベル Excel の投稿を表示しています。 すべての投稿を表示

木曜日, 9月 06, 2012

Excel のマクロを消すマクロ

Excel のマクロを消すマクロを書こうと思ったら、警告が出ました。

マクロはこんな感じです。

こちらのページ「VBAでマクロのソース削除と標準モジュール削除」を参照させていただきました。

Dim objVBCOMPO     As Object
        For Each objVBCOMPO In ActiveWorkbook.VBProject.VBComponents
            With objVBCOMPO.CodeModule
                If .CountOfLines <> 0 Then .DeleteLines 1, .CountOfLines
            End With
            If (objVBCOMPO.Type = vbext_ct_StdModule Or objVBCOMPO.Type = vbext_ct_MSForm) Then
                ActiveWorkbook.VBProject.VBComponents.Remove objVBCOMPO
            End If
        Next objVBCOMPO
        Set objVBCOMPO = Nothing
End Sub


これをデフォルトの設定で走らせると警告が出ます。



これは、マクロセンターの Trust access to the VBA project object model オプションをオンにすると動くようになります。

火曜日, 10月 18, 2011

Excel / VBA: type conversion from integer to text

Excel uses VBA for its macros. The programming language, or the formula format, differs. Whereas Excel uses "TEXT()" with a format string as its argument, VBA uses "CStr()" to convert types from integer to string.

Flask の Blueprint のテンプレート問題

  Flask の Blueprint は、ルート、静的ファイル、テンプレートをまとめて管理できます。しかし、テンプレートが指定できません。 ここでは、Blueprint の template_folder の問題点と回避策を説明します。 Blueprint のテンプレート問題...