|
-
Aug 9th, 2023, 01:36 PM
#1
Thread Starter
Addicted Member
Adding text to bookmarks in a word doc without word automation
Hi
I've got a word doc with several bookmarks. I use a vb.net program to add text to some bookmark locations in the doc, save it as a pdf, and then save the doc to a new location.
I need the program to run as a scheduled task under a certain login account. I've got the task launching and the program working under my login OK, but it fails to do any word automation when I use the account I need to run it with. I suspect an issue with using Office 365, as the login I need to use doesn't have a 365 account - I thought I could use my creds on the 365 login, but it isn't working.
So, I need to find an alternative to Word automation for adding text to bookmarks in a word doc.
This is the sort of thing I currently do:
Code:
Dim oWord As Word.Application
Dim oDoc As Word.Document
oDoc = oWord.Documents.Open(filename)
oDoc.Bookmarks(bookmark_name).Range.Text = "Text I want to use"
oDoc.SaveAs(output_file)
Call oDoc.SaveAs2(pdf_name, 17)
oDoc = Nothing
oWord.Quit()
oWord = Nothing
I also have to use some code with word.range with one bookmark to get bold and italics to work, but this is essentially it.
I'm looking for a simple way to replicate the above without using Word automation. Can anyone suggest a good route for me to explore please?
Cheers
Tags for this Thread
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
|