With long words you have to insert an hyphenation point to suggest a break place.
Later, with the literate keyword, each \- is replaced by the red \hookrightarrow.
breaklines=true activates the automatic line breaking of long lines of code. For example if breakatwhitespace=true allows to insert a line break only at a white space.
Note
For inline listing, it is possible to add as many \- as you like (see the answer), to tell TeX where a proper line break could occur. Tex will make (mostly) a good choice.
That way changing the text of the document should not be a big problem. In the final version, like all the overflow boxes, they will need to be visually checked.
This is normal procedure with long proper names, foreign words, etc. when the hyphenation tables do not have a proper place to hyphenate.
The difference between the two styles is where the red arrow appears. For inline it is better to have it before the line break.
Related answers
hyphens in listings
listings line wrapping

\documentclass{article}
\usepackage{listings}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage[showframe,margin=5cm]{geometry}
\usepackage{blindtext}
\usepackage{courier}
% https://tex.stackexchange.com/a/168532/161015
% https://tex.stackexchange.com/a/116572/161015
\lstdefinestyle{display}% displayed listings
{
basicstyle=\small\ttfamily,
numberstyle=\small\ttfamily,
language=[Visual]Basic,
columns=fullflexible,
xleftmargin=30pt,
breaklines=true,
breakatwhitespace=true,
breakindent=30pt,
keywordstyle=\color{blue},
literate={\-}{}{0\discretionary{}{\mbox{\textcolor{red}{$\hookrightarrow$}\space}}{}} %arrow in the new line
}
\lstdefinestyle{inline}
{%
basicstyle=\small\ttfamily,%
literate={\-}{}{0\discretionary{\mbox{\textcolor{red}{$\hookrightarrow$}\space}}{}{}} % arrow before line break
}
\begin{document}
\begin{lstlisting}[style=display]
Sub
Public UserID As Integer TEstThatLongVariableNamesDontBreakUp-ProperlyWithin-TheLstListingEnvironment-CheckitOutForYourselfIsnt-ThatWeird()
Debug.Print("hello world")
End Sub
\end{lstlisting}
\blindtext
Here is a very long variable name which overflows the line and needs to not do that see what I mean
{\color{green!40!black}
\lstinline[style=inline]!Asanydedicatedreadercanclearly-seeour-apriori-conceptsarewhatfirst-giverisetthe-Categories-Hume-tell-sus-that-our-ideasarejust-asnecessary-asontheother-hand-natural-causes!}
\end{document}