Guest Andrew Report post Posted January 20, 2006 Anyone have any info on interacting with the MS Word API? I'd like to control a mail merge from a DB with my VB app - I figured i'd use Words printing abilities and mail merge sh*t rather that write my own software to print and mail merge. Any ideas? DB is MDB and I connect to it using DAO. Have seen apps integrate with Word in the past giving it SQL commands. Quote Share this post Link to post Share on other sites
Carl 3 Report post Posted January 20, 2006 Explain to me what you're trying to do? My initial advise would be to not use Word for anything but low level stuff Quote Share this post Link to post Share on other sites
Guest Andrew Report post Posted January 20, 2006 basically i have a VB app - and it spews out a report And usually I would output to a txt file HTML code and make an HTML report - but in this case I need to print - and its hard to do printer formatting when doing a webpage. So - i'd like to output some fields from my program - into a letter - and print a batch of letters. e.g usually this type of output to update the website - but now i want to make a printable letter Dim i As Integer Open App.Path & "\index.html" For Output As #1 'put pretty PWAL logo up top + HTML formatting sh*t Print #1, "<html>" Print #1, "<head>" Print #1, "<title>Premium Wholesale Auctions LTD - Dealer Wholesale List. Updated " & Date & "</title>" Print #1, "</head>" Print #1, "<body>" Print #1, "<p align=""center""><img border=""0"" src=""PWA_logo_2col.jpg"" width=""640"" height=""172""></p>" Print #1, " " Print #1, "<font face=""Tahoma"" size=""1"">" Print #1, "<p align=""center""><a href=""http://www.premium-auctions.co.nz/legend.html""><b> Click here to view extras legend </p></b></a>" Print #1, Print #1, "<p align=""center""><b> Contact: Stephen Thwaites 021 687 702 OR Melanie McGovern 021 468 808 </p></b>" 'initial table formatting - chuck in table headings Print #1, "<font face=""Tahoma"" size=""1"">" Print #1, "<div align=""center""> <table border=""1"" cellspacing=""1"">" 'width=""100%"" Print #1, "<tr>" Print #1, "<td>Stock</td><td>Year</td><td>Colour</td><td>Make</td><td>Model</td><td>Fuel</td><td>Odo</td>"; Print #1, "<td>Rating</td><td>Other</td><td>Body</td><td>Trans</td><td>Doors</td><td>Retail</td><td>Pics</td>"; Print #1, "</tr>" i = 1 Rs.MoveFirst Rs.MoveNext 'to get rid of the ugly blank line at the beg. of the DB 'load a whole line into the table - then move to next line While Rs.EOF = False Print #1, "<tr>" Print #1, "<td>" & Rs!StockNum & "</td><td>" & Rs!Year & "</td><td>" & Rs!Colour & "</td><td>" & Rs!Make & "</td>"; Print #1, "<td>" & Rs!Model & "</td><td>" & Rs!Fuel & "</td><td>" & Rs!Odo & "</td>"; Print #1, "<td>" & Rs!Rating & "</td><td>" & Rs!Options & "</td><td>" & Rs!Body & "</td><td>" & Rs!Trans & "</td>"; Print #1, "<td>" & Rs!Doors & "</td><td>" & Rs!Retail & "</td>"; Print #1, "<td>"; While i < 4 Print #1, "<a href="""; Print #1, Rs!StockNum & "-" & i & ".JPG""" Print #1, ">" & i & " " Print #1, "</a>" i = i + 1 Wend Print #1, "</td>"; Print #1, "</tr>" 'newline Rs.MoveNext 'new record i = 1 Wend Close #1 'Call batch file to begin pictures/webupload ShellExecute Me.hwnd, "open", "J:\sundry\webprem.bat", 0&, 0&, 1 Quote Share this post Link to post Share on other sites
Carl 3 Report post Posted January 20, 2006 I find your original method easier, what's hard about printer formatting? Quote Share this post Link to post Share on other sites
BMW POWER 2 Report post Posted January 20, 2006 (edited) Oh. My. God. And I thought reading music sheets for drums was complicated. Edited January 20, 2006 by BMW POWER Quote Share this post Link to post Share on other sites
bumpstop325 0 Report post Posted January 20, 2006 record us a beat, emma. and stick it on the net. Quote Share this post Link to post Share on other sites
WarlockNZ 0 Report post Posted January 20, 2006 (edited) I see your problem. .. your VB app outputs an html page right .. ?? Printing that from word would just give you the code and not the formatted text. correct me if i'm wrong but you want to strip the hmtl and just print the text? if thats the case .. you should be able to setup a macro (in word) to stript the html code and leave you with the plain txt. there are much eaiser ways to output your date tho, ahh ... here's the geek .. mu ha ha .. are you pulling data from a database?, can you change your vb script or is it compiled? .. so many questions ... Looking at your code it seems like you are trying to output a list from a database. you can send html via outlook and have it show up on the users end as a page but you need absolute links. If you cant modify your vb script .. you may need to look at doing it a different way... it all depends on the backend DB you are running, writing code to extact your info isn't that hard. If you need help my friend .. I do this sh*t for a living .. get in touch and we can see what we can do Edited January 20, 2006 by WarlockNZ Quote Share this post Link to post Share on other sites
BMW POWER 2 Report post Posted January 21, 2006 record us a beat, emma. and stick it on the net. I haven't got a drumset at home.I drum at school. But I do get tabs off the net and re-do the drums on my drum machine on the computer. So far I've done a bit of Rammstein - Mutter. Quote Share this post Link to post Share on other sites