I'm working with a Java application that is going to write a .dat
file that is supposed to be used as a template to fill a Word
template that has fields
and bookmarks
in it. I've spent quite awhile searching for information on .dat
files being used to template a Word field/bookmark
and I've yet to come up with anything.
I have the VBA code written to go and get the file, but I have two large problems that I can't seem to locate the answer to. I'd appreciate if someone could answer the following:
What should the
.dat
file code look like? (not the code to generate it, have that, but how should it be formatted to achieve the desired result)After I open the
.dat
file withVBA
, do I need to do anything code-wise to have it replace thefields/bookmarks
with its data?
Currently I do have the code to go out and get the .dat
file and open it. I have code written to do inserts for bookmarks and fields, but seeing as how I wasn't sure if there was a specific structure to.dat
files for vba
to read, I didn't know if it was pertinent or not. Thank you to Jean-François Corbett and Roman for clarifying this.
Taking this into consideration, I've decided to use the following .dat
file format.
File.dat
RequisitionHeader_requisitionNumber=11-2019
RequisitionHeader_poNumber=889-0936
RequisitionHeader_orderDate=11/12/1901
With that, using the VBA
I have now that opens the file, do I need to write a text parser inside of VBA
to find and replace values into the corresponding field/bookmarkName?