gpt4 book ai didi

vba - CorelDraw VBA 宏错误 : "Object Required"

转载 作者:行者123 更新时间:2023-12-04 18:22:59 29 4
gpt4 key购买 nike

我正在为 CorelDraw 创建一个宏,它会在按下名为 Generate 的按钮时从给定文件夹导入文件。尝试将文件路径分配给变量时,出现以下错误:

Object Required

这是我的代码:

Private Sub UserForm_Initialize()

'Design Of Item'

Me.DesignList.AddItem ("BIFT")
Me.DesignList.AddItem ("BIFC1")
Me.DesignList.AddItem ("BIFC2")
Me.DesignList.AddItem ("BIFI")

'Type Of Item'

Me.TypeList.AddItem ("BIF HOODIE")
Me.TypeList.AddItem ("BIF T-SHIRT")
Me.TypeList.AddItem ("BIF SWEAT")
Me.TypeList.AddItem ("BIF TANK")

'Colours of the items'

Me.ColourList.AddItem ("Grey")
Me.ColourList.AddItem ("White")
Me.ColourList.AddItem ("Black")
Me.ColourList.AddItem ("Navy")

Dim Design As String
Dim Ctype As String
Dim Colour As String
Dim ShirtFPath As String

End Sub

Private Sub GenerateBtn_Click()
Set ShirtFPath = ("C:\Users\Matt\Pictures\Clothing Line\Shirts")
MsgBox (ShirtFPath)
Set Design = DesignList.Value
Set Ctype = TypeList.Value
Set Colour = ColourList.Value
End Sub

Private Sub SaveBtn_Click()

Dim fPath As Object
Dim sr As ShapeRange

Set fPath = Me.TB.Value
If fPath Is Nothing Then Exit Sub
End Sub

最佳答案

您仅使用Set 进行对象分配。对于内部类型(数字、字符串、 bool 值),省略单词 Set:

ShirtFPath = "C:\Users\Matt\Pictures\Clothing Line\Shirts"
Design = DesignList.Value
Ctype = TypeList.Value
Colour = ColourList.Value

关于vba - CorelDraw VBA 宏错误 : "Object Required",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31629397/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com