Re: a string to an integer

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Don't use String and Int as variable names.

String is a VBA function and data type.
Int is a VBA function.


Dim myString(1 To 3) As String
Dim myInt As Long
myString(3) = "543"
myInt = CInt(myString(3))

Personally, I wouldn't use "as integer" or cInt(). I'd use "As long" and
clng().

Philosophaie wrote:

I have a string:

string(3) = "543"

I try to change it to an integer:

int = cint(string(3))

It gives me a 'Type Mismatch' Error.

Maybe there may be spaces before of after the numbers but does that matter?

How do I change from a string to an integer?

--

Dave Peterson
.



Relevant Pages

  • Re: FTP
    ... Dim dwFileAttributes As Integer ... Public cAlternate As String ... > public int dwHighDateTime; ... > public static extern IntPtr InternetConnect( ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... conformant string. ... int repeats, reps; ... ref satisfierLength); ...
    (comp.programming)
  • RE: Controling Modal Dialogs (Solution)
    ... doesn't return until the 'modal' browser returns. ... string varOptions) ... public void DocumentComplete ... int rc = winDisp.Invoke(rgDispId, ref guid, 0, ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Gcc compatible header file
    ... A string collection is a table of zero terminated strings that will grow ... typedef struct _StringCollection StringCollection; ... int; ... bool; ...
    (comp.lang.c)
  • Re: How can I get Atributes from the field of the table via VBA
    ... I think is data type in code ... "Brendan Reynolds" wrote: ... Caption As String ... Dim tdf As DAO.TableDef ...
    (microsoft.public.access.adp.sqlserver)