すべてのプロジェクトをプロジェクトグループに追加し、それらのプロジェクトの各コンポーネントを反復処理し、フォームまたはユーザーコントロールが見つかった場合はそのプロパティを変更するVB6アドインがあります。
プロパティはユーザーが定義します。ユーザーがすべてのフォームまたはユーザーコントロールの高さを変更したい場合、コードスニペットは次のようになります
Private Sub Update_ButtonClick()
'..declaring all the variables here
' VBInstance is initialized to VBIDE.VBE when the add-in is loaded
For Index = 1 To projCount
compoCount = VBInstance.VBProjects(Index).VBComponents.Count
For jIndex = 1 To compoCount
csFileName = VBInstance.VBProjects(Index).VBComponents(jIndex).name
componentType = VBInstance.VBProjects(Index).VBComponents(jIndex).Type
If componentType = VBIDE.vbext_ct_VBForm Or componentType = VBIDE.vbext_ct_UserControl Then '.frm or .ctl
VBInstance.VBProjects(Index).VBComponents(jIndex).Properties(propChange).Value = propvalue 'changing the property
VBInstance.VBProjects(Index).VBComponents(jIndex).SaveAs csFileName 'Saving the file
End If
Next jIndex
Next Index
End Sub
プロパティ名をとして指定Font
すると、エラーが発生します
ランタイムエラー「425」オブジェクトの使用が無効です
http://visualbasic.freetutes.com/learn-vb6-advanced/lesson13/p20.htmlPropertyBag.WriteProperty
から試しましたが、目的を果たしていません。
Font
コントロールまたはフォームのプロパティを設定する方法はありますか?
メモ帳でctlまたはformを開くと、プロパティが見つからないため、Font
ここでテキスト置換を使用できません。
誰か助けてもらえますか?
更新されたコード:
Private Sub Update_ButtonClick()
Dim fobject As New StdFont
fobject.Name = "Arial"
Set propvalue = fobject
For Index = 1 To projCount
compoCount = VBInstance.VBProjects(Index).VBComponents.Count
For jIndex = 1 To compoCount
csFileName = VBInstance.VBProjects(Index).VBComponents(jIndex).Name
componentType = VBInstance.VBProjects(Index).VBComponents(jIndex).Type
If componentType = 5 Or componentType = 8 Then
VBInstance.VBProjects(Index).VBComponents(jIndex).Properties("Font").Value= propvalue
VBInstance.VBProjects(Index).VBComponents(jIndex).SaveAs csFileName
End If
Next jIndex
Next Index
End Sub
そして、私が得たエラーは
Run-time error '425':
Invalid object use