CorelDraw VBA Macro Error: "Required Object"

I am creating a macro for CorelDraw that will import a file from a given folder when a button named is clicked Generate

. When trying to assign a path to a variable to a variable, I get the following error:

Required object

Here's my code:

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

      

+3


source to share


1 answer


You only use Set

to assign an object. For internal types (numbers, strings, booleans) omit the word Set

:



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

      

+1


source







All Articles