Results 1 to 3 of 3

Thread: "Compile Error: Expected: =" when trying to call a sub

  1. #1

    Thread Starter
    Fanatic Member mikeycorn's Avatar
    Join Date
    Jun 2000
    Location
    Aliso Viejo, CA, USA
    Posts
    526

    "Compile Error: Expected: =" when trying to call a sub

    I'm trying to call a sub with three parameters.

    Code:
    CenterPrint(Titl, "Arial", 24)
    
    .
    .
    .
    
    Private Sub CenterPrint(ByVal Text As String, Optional ByVal FName As String, Optional ByVal FSize As Integer)
      If FName Then Printer.Font.Name = FName
      If FSize Then Printer.Font.Size = FSize
      Printer.CurrentX = Printer.ScaleX / 2 - Printer.TextWidth(Text) / 2
      Printer.Print Text
    End Sub
    Why does VB tell me "Compile Error: Expected: ="
    ~ mikeycorn

    With over 45,000 Questions in the User Submitted Database, it's the Most Popular Quiz Creation Software on the Net:

    PEST - The Personal Exam Self-Tester

  2. #2
    Fanatic Member
    Join Date
    Feb 2002
    Location
    SE England
    Posts
    732
    Coz your not doing anything with the return value you need to remove the parenthasis from around the arguments...

    CenterPrint Titl, "Arial", 24


    or use

    Call CenterPrint(Titl, "Arial", 24)
    Leather Face is comin...


    MCSD

  3. #3

    Thread Starter
    Fanatic Member mikeycorn's Avatar
    Join Date
    Jun 2000
    Location
    Aliso Viejo, CA, USA
    Posts
    526
    God bless you, young man.
    ~ mikeycorn

    With over 45,000 Questions in the User Submitted Database, it's the Most Popular Quiz Creation Software on the Net:

    PEST - The Personal Exam Self-Tester

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width