I have a macro that takes pertinent info from our customer's orders. PO number, order date, etc. This info will then be pasted into a new document (along with other orders of the day) for upload into our online database. We also want to automatically generate a link for the client to view a PDF of their order. To import a link into the database, it must contain html tags. The macro copies the PO number (123456) and pastes it into the link cell. Then the macro appends this to the front of the number:
<a href="http://www.ourwebaddress/
And appends this to the end:
.pdf">thumbnail</a>
So, ideally, we end up with:
<a href="http://www.ourwebaddress/123456.pdf">thumbnail</a>
The problem are the quotes. Particularly since we are adding the opening and closing quotes separately because the actual PO number is a variable. The quotes create errors.
I have also tried adding the tags minus the quotes and then using the replace function to replace http with "http and pdf with pdf". No luck there either. I'm fairly new to this and I'm sure there is probably an easy fix. Any help will be greatly appreciated.
Last edited by Zarkov; 10-20-2010 at 04:16 PM.
With no code of yours to look at, this is just to show you the syntax for including quotes in a string:
Dim POnum As String: POnum = Range("A1") Dim Pref As String: Pref = "<a href=""http://www.ourwebaddress/" Dim Suff As String: Suff = ".pdf"">thumbnail</a>" Range("B1") = Pref & POnum & Suff
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
@zarkov, if you opt to post the same question of multiple message boards please have the courtesy to disclose all relevant links
http://www.mrexcel.com/forum/showthread.php?t=503109
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Thank you. That did it. I was putting in too many extra quotes trying to over-enclose the url.
I knew it was a simple fix.![]()
Sorry, didn't realize I was being discourteous. Just had a question, found two high profile forums and posted.
It's simply the fact that whilst others may trying to resolve your problem at MrExcel they are unaware that the issue has been resolved already here.
It follows that whatever free time they spent on it could have been better spent aiding someone else.
Were roles reversed JB would have his time wasted.
For the most part people don't mind if you cross post they just ask you let them know so they can see if the issue is resolved before working on it.
That said regular cross posters generally find their posts ignored over time as people become wary of getting involved for reasons stated above.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Change made, thanks again.
And I see your point about time wasting. I'll do that in the future.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks