Why is this Variable

Mackeral

Board Regular
Joined
Mar 7, 2015
Messages
232
Office Version
  1. 365
Platform
  1. Windows
I have this code
Code:
Row_Id = "0a"
Call Parse_Line(Prog, 0, Line, Orig_Code, Calling, Row_Id)
which calls this function with a line of code in it:
Code:
Function Parse_Line(Prog, Lvl, Code, Orig_Code, Calling, Row_Id) As Boolean

        Flag = Parse_Expression(Prog, Lvl, Code, Orig_Code, Calling, Row_Id)
and the definition of Parce_Expression is
Code:
Function Parse_Expression(Prog, Lvl, Code, Orig_Code, Calling, Row_Id) As Boolean
When I run this code, I get a compiling error in "Parse_Line" that says "Row_Id" is "ByRef argument Type Mismatch" (no error number given).

There is no definition of "Row_Id" in the program definition, and the code worked an hour ago. I have explictly gone through and put "as String" on all definitions references to "Row_id" and I still get the error.

Any idea what might be going on? This kind of stuff drives me batty when something works and then stops.


Mac
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I think it has to do with your passing Row_Id ByRef (the default when nothing is specified) which means you are giving your code access to the memory location used by VB to store values in that variable. I am guessing that one of your assignments to it in the called function uses Row_Id in a different way (underlying data type) than was used in the original calling program. I presume you are not attempting to physically change the original value in the first calling program, so I would declare that variable this way in each function header...

ByVal Row_Id As ****

(change the **** to a real data type) after which I would think your code should work fine.
 
Upvote 0
Solved: Why is this Variable Giving an Error

Stupid Programming Error

Thanks for your responses. I'd spent a couple of hours on this before posting and really thought I'd come across a system error.

The problem was calling the wrong subroutine with a different number of attributes.

Mac
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top