LoadResData Function


LoadResData(resID, resType)


Use: Required

Data Type: Variant

A numeric or string value specifying the resource ID of the data to load.


Use: Required

Data Type: Variant

A numeric or string value denoting the format of the data to load. See the table below for valid values:

ResType Value Meaning
1 Cursor resource
2 Bitmap resource
3 Icon resource
6 String resource
10 User-defined resource
12 Group cursor
14 Group icon

Return Value

A Unicode string.


Returns a binary (Unicode) string containing the specified resource from a resource (.RES ) file included with the project.

Resource files store graphics, strings, and other data inside the application, the contents of the .RES file being compiled into the final EXE. The advantage of storing support files in this manner is that they are permanently available to the application, unlike separate support files that can be accidentally deleted or not transferred should the application be moved. You can also store several localized versions of your resources in the .RES file that loads depending on the locale of the current machine, thereby easily internationalizing your application.

Rules at a Glance

  • You can pass a string value to restype if you are loading a custom or user-defined resource. For example:

    sRTFText  = LoadResData(102, "CUSTOM")

    This is the only case in which a string value is permitted.

  • The maximum string length returned by LoadResData is 64KB.

  • In Visual Basic, there is ...

Get VB & VBA in a Nutshell: The Language now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.