I posted the link in the comments, but I'll flush out the example on the wiki here with some added commentary.
We have $f(x)=e^x$ and we know by Taylor'r theorem that
$$f(x)=P_k(x)+R_k(x)=1+x+\frac{x^2}{2}+\frac{x^3}{6}+\cdots+\frac{x^k}{k!}+R_k(x)$$
where $R_k(x)$ is our error term and $P_k(x)$ is the Taylor polynomial. We want to find the $k$ such that $R_k(x)<10^{-7}$ for $x\in[-1,1]$.
We know that the remainder term $R_k(x)$ can be expressed as
$$R_k(x)=\frac{e^\xi}{\left(k+1\right)!}x^{k+1}$$
for some $\xi\in[-1,1]$. We need to find the value of $\xi$ though. And since we don't know $e^x$ (otherwise we'd just use that function) we again approximate it using a lower order Taylor expansion
$$e^x=P_1(x)+R_1(x)=1+x+\frac{e^\xi}{2}x^2$$
Since $e^x$ is an increasing function, we know that $e^\xi<e^x$ when $-1<\xi<x$. So we can say
$$e^x=1+x+\frac{e^\xi}{2}x^2<1+x+\frac{e^x}{2}x^2$$
Which we can solve for $e^x$ and get
$$e^x<2\frac{x+1}{2-x^2}$$
Some basic calculus gives us that the maximum of this expression for $x\in[-1,1]$ is at $x=1$ and $e^x<4$.
Therefore
$$R_k(x)=\frac{e^\xi}{\left(k+1\right)!}x^{k+1}<\frac{4x^{k+1}}{\left(k+1\right)!}$$
And since $x^{k+1}$ is a maximum on $[-1,1]$ at $x=1$ and we want $R_k(x)$ to be less than $10^{-7}$ we have
$$R_k(x)<\frac{4}{\left(k+1\right)!}<10^{-7}$$
So basically, we just need to find $k$ such that $(k+1)!>4\cdot10^7$. And $11!=39916800=3.99\cdot10^7$ which is reallllly close. But, really we need $(k+1)!=12!$ so $k=11$.
Now... this is a very modest upper bound. If we really think about it (and this is what you did), the upper bound on the interval $[-1,1]$ is $e$. So if we did this with $e^x<e$ on $x\in[-1,1]$ instead, then we'd end up with
$$\frac{e}{\left(k+1\right)!}<10^{-7}\implies (k+1)!>2.718\cdot10^7\implies k=10$$
Same as you got. However, this relies on the fact that we know $e$ already.
If we don't know $e$ we can use a higher order approximation than $2$. So we find that
$$e^x<\frac{6+6x+3x^2}{6-x^3}$$
Which means it's either $e^x<\frac{15}{5}=3$ if it's at $x=1$ or it's at the maximum of the interval which involves find the roots of a fourth order polynomial $3x^4+12x^3+18x^2+36x+36$ whose critical points turn out not to be on our bound. So we can use this higher order approximation the same way we did before and get that
$$\frac{3}{\left(k+1\right)!}<10^{-7}\implies (k+1)!>3\cdot10^7\implies k=10$$
From there, you can either hard code the approximation
$$e^x\approx \text{myFunc}(x)=1+x+\frac{x^2}{2}+\frac{x^3}{3!}+\frac{x^4}{4!}+\frac{x^5}{5!}+\frac{x^6}{6!}+\frac{x^7}{7!}+\frac{x^8}{8!}+\frac{x^9}{9!}+\frac{x^{10}}{10!}$$
or do a sum like this in a for loop
$$e^x\approx \text{myFunc}(x)=\sum_{i=0}^{10}\frac{x^i}{i!}$$
It appears as though Arkamis gave you some MATLAB code that'll do this for you, though.