-
Apr 12th, 2017, 03:47 AM
#1
Thread Starter
New Member
Can i use VB to query data in excel and export to word?
Its been a while since ive done anything VB related so im very very rusty
Is there any way to get VB to query a dataset in excel and export the results and original table to a Word template saved on sharepoint then save the new template as a new file?
Will be a simple is todays value greater or less than the previous days then export in the form of a red amber or green arrown with some text in the arrows.
-
Apr 12th, 2017, 05:45 AM
#2
Fanatic Member
Re: Can i use VB to query data in excel and export to word?
Is there any way to get VB to query a dataset in excel
This part, sure.
and export the results and original table to a Word template saved on sharepoint then save the new template as a new file?
This part is however confusing - do you need your data in Excel and also Word document, or just a Word document ? ....Anyway, It can be done, but that will take you some time and effort, depends on how your template is designed. For more clearer answers ask a reasonable question, some code won't harm too.
-
Apr 14th, 2017, 12:38 PM
#3
Re: Can i use VB to query data in excel and export to word?
a Word template saved on sharepoint
That's the trickiest part ... dealing with SharePoint... compared to that, the rest should be a breeze.
Getting data out of Excel... easy, you can open the file using ADO ... just use the correct settings in the connectionstring.
Putting the data into the word document (once you can get it out of SP) shoiuld be a simple loop through the Word objects, find the fields you want to stuff, and putting it in there.
Then of course you SaveAs (doin't save, or it'll overwrite the template) the file and ... what ever you need to do next.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|