Originally Posted by
lougs7
imgHTML = Mid(strHTML, imgStart, imgEnd - imgStart) this line returns the runtime error 5: Invalid procedure call or argument. Am I doing this right?
Nope. see below images:
image 1: you kept the image-based HTML code that I used for my test. every image generates different HTML code silly! ha ha ha. thus, change it via this process:
print the HTML content out like I mentioned in a previous post by running through the HTMLbody property and using debug.print. either that, or run the code you just tried and when it breaks, write ?strHTML in the immediate window. copy all of it into notepad. see image 2. copy that code into this line as a replacement for the old. you should know how by now:
image 2: me searching for the actual image code that outlook spit out when I created a test email and manually embedded an image into it using outlook's interface menu.
image 3: my replacement code, put into VBA.
image 4: the test email I created manually.
image 5: the result of running the code I gave you on my test email.
Originally Posted by
lougs7
Lastly I commented on this part, I wasn't sure if I take this out since olInsp is a Word thing, as you explained
Set olInsp = .GetInspector ' do I delete this from my old code or keep?
Set wdDoc = olInsp.WordEditor 'do I delete this from my old code or keep?
Set rng = wdDoc.Range.FormattedText 'do I delete this from my old code or keep?
I kept all of that in my example, but none of those lines are really needed.
Keep in mind that I just run this new test using the following rules:
1) ran the test in a single instance of outlook. did not run it from excel. and thus, had to do this:
2) added new code:
you do not have to do any of that because you are running things on your end from inside excel.
3 images are attached here. 2 are found in the following post.
Bookmarks