Compile Error Expected Function Or Variable In Vb6.0
soon) Ruby (coming soon) Getting Started Code Samples Resources Patterns and Practices App Registration Tool Events Podcasts Training API Sandbox Videos Documentation Office Add-ins Office Add-in Availability Office Add-ins Changelog Microsoft Graph API Office 365 Connectors Office 365 REST APIs SharePoint Add-ins Office UI Fabric Submit to the Office Store All Documentation https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Office VBA language reference Visual Basic language reference Error Messages Error Messages Expected Function or variable Expected Function or variable Expected Function or variable #Else clause must be preceded by a matching #If #Else If, #Else, or #End If must be preceded by a matching #If #ElseIf must be preceded by a matching #If or #ElseIf and followed by an #ElseIf, #Else, or #End If
Function or Variable If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 4 of 4 Thread: [RESOLVED] Compile Error: Expected Function or Variable Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Apr 18th, 2010,01:07 AM #1 johnsonlim026 View Profile View Forum Posts Thread Starter New Member Join Date Apr 2010 https://msdn.microsoft.com/en-us/library/office/gg264652.aspx Posts 9 [RESOLVED] Compile Error: Expected Function or Variable Hi, i am new to vb6 and this is my first time deal with vb6 I have created from A and form B. In form A i call function X in form B. And it is workable. However, this is i have a project that is written by other programmer , i face this error: Compile Error: Expected Function or Variable . when http://www.vbforums.com/showthread.php?611649-RESOLVED-Compile-Error-Expected-Function-or-Variable a function call a public function in other form. I not yet even step into the coding and this error has appear. Here is the coding in the calling form Code: Dim lofrmImport As New frmImport If lofrmImport.cmdAddWEB(vbTab) Then End If Here is the coding for the function to be called. Code: Public Sub cmdAddWEB(Optional psDelimiter As String = vbTab) Dim lbLoaded As Boolean Dim lbVerify As Boolean ' Verify status Dim llCurrent As Long ' Pointer to file position Dim lnCount As Integer Dim loListImport As MSComctlLib.ListItem Dim loListStatus As MSComctlLib.ListItem Dim llFNum As Long Dim lnTag As Integer ' Tag pointer Dim llLine As Long ' Line number Dim lsLine As String * MAX_LINE_LENGTH Dim lsFileArray() As String Dim lsFileName As String Dim nFiles As Integer Dim lsFields() As String 'terri If automateOn Then If gbAutomateOn Then lbLoaded = False On Error GoTo 0 'goSlrError.Trace "AddLog recorded for " & gsFileName WriteLog 1, "AddLog recorded for " & gsFileName 'Open Logfile, for cmdAdd recording GoTo Automate End If dlgCommon.CancelError = True dlgCommon.DialogTitle = "Select import file" dlgCommon.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt" dlgCommon.Flags = cdlOFNExplorer + cdlOFNFileMustExist + cdlOFNReadOnly + cdlOFNAllowMultiselect dlgCommon.FilterIndex = 2 dlgCommon.CancelError = False dlgCommon.ShowOpen On Error GoTo ErrorHandler Automate: 'terri If automateOn Then If gbAutomateOn Then
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company http://stackoverflow.com/questions/28826194/error-expected-function-or-variable Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just http://vbcity.com/forums/t/44767.aspx like you, helping each other. Join them; it only takes a minute: Sign up Error: Expected function or variable up vote 0 down vote favorite 1 I am writing a small utility in VB6 which is calling compile error the C#.Net class (which brings list of printers) but while calling the C# method, it is throwing below error and I am not able to compile/run the application. Can someone please help on this? VB6 Code: Dim retval As Integer Dim tbp As NamespaceXYZ.CGETList Dim a As String Dim col As New Collection Set tbp = New CGETList retval = tbp.GetDefaultPrinterAndList(col, a) C# definition for the method. public void GetDefaultPrinterAndList(ref Microsoft.VisualBasic.Collection vntPrinterList, ref string compile error expected defaultPrinter) { error: c#-4.0 vb6 com-interop share|improve this question edited Mar 3 '15 at 14:56 Jean-Francois Corbett 23.9k1678113 asked Mar 3 '15 at 7:21 atp9 12712 Methinks you will need to use a string array instead - mixing languages types may not work. –Anthony Horne Mar 3 '15 at 7:25 thanks for suggestion but Just now I realize that it is throwing this error because in above code object is not getting initialized in VB. When I added the watch, found that "tbp" is set to nothing. Any idea why? –atp9 Mar 3 '15 at 8:05 It should take you to a specific line when you get that compile errro. Which line is it? –MarkJ Mar 3 '15 at 12:12 thanks for the suggestion guys. Just now found the cause (And Solution) why it is giving me an error. The problem here is that the method I have written in C# doesn't return any value whereas the invocation in VB6 is expecting some return value. Hence, I changed my method in C# to return simply integer (1) and problem got resolved. I read somewhere that we should have a return value while calling the Interop methods but I didn't give that much attention to it. –atp9 Mar 3 '15 at 16:51 add a comme
or variable rated by 0 users This post has 4 Replies | 1 Follower webmanoffesto Since 9/29/2003 Posts 49 Reputation 1,025 Reply webman offesto (webmanoffesto) Posted: 11/3/2003 6:13 AM rated by 0 users I'm doing my first experiment with a control array.I have 5 command buttons in the control array cmdImagePictureCode:Private Sub cmdImagePicture_Click(Index As Integer)If cmdImagePicture_Click(Index) = 0 ThentxtOutput = "cmdImagePicture_Click(Index) = 0"'imgCoolbuddy.Picture = App.Path & "\dancing-coolbuddy.gif"End Subgives me:compile error expected function or variableCode:Private Sub cmdImagePicture_Click(Index As Integer)If cmdImagePicture_Click(Index) = 0 Then'txtOutput = "cmdImagePicture_Click(Index) = 0"imgCoolbuddy.Picture = App.Path & "\dancing-coolbuddy.gif"End Subgives me:compile error expected function or variableHow do I fix this | Post Points: 35 psmurf Kansas City, MO Since 2/28/2002 Posts 319 Reputation 2,195 Reply Brad Casey (psmurf) replied on 11/3/2003 6:33 AM rated by 0 users You're getting this error because of the following line:Code:If cmdImagePicture_Click(Index) = 0 Then Since cmdImagePicture_Click() is a Sub Procedure, there is no return value, therefore you can't compare anything to 0. So, VB gives you a message it is looking for a Variable to compare to 0, or a Function that will return a value that can be compared to 0. I think what you are trying to accomplish is this:Code:If Index = 0 ThenThis will check to see if the first button was clicked.HTH,Brad Casey | Post Points: 5 webmanoffesto Since 9/29/2003 Posts 49 Reputation 1,025 Reply webman offesto (webmanoffesto) replied on 11/3/2003 6:45 AM rated by 0 users Okay that's working better.Now I'm getting Compile Error, Type Mismatchon the line Code:imgCoolbuddy.Picture = App.Path & "\dancing-coolbuddy.gif"What is the problem with that line. I've used it before. Could the & be the problem. | Post Points: 5 psmurf Kansas City, MO Since 2/28/2002 Posts 319 Reputation 2,195 Reply Brad Casey (psmurf) replied on 11/3/2003 6:52 AM rated by 0 users Give this a shot and see if it works:Code:imgCoolbuddy.Picture = LoadPicture(App.Path & "\dancing-coolbuddy.gif")HTH,Brad Casey | Post Points: 5 webmanoffesto Since 9/29/2003 Posts 49 Reputation 1,025 Reply webman offesto (webmanoffesto) replied on 11/3/2003 7:17 AM rated by 0 users That's great. Thanks. | Post Points: 5 < Previous Topic | N