Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7552225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:42:26+00:00 2026-05-30T10:42:26+00:00

I’m working with a Java application that is going to write a .dat file

  • 0

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:

  1. 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)

  2. After I open the .dat file with VBA, do I need to do anything
    code-wise to have it replace the fields/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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:42:27+00:00Added an answer on May 30, 2026 at 10:42 am

    OK, now one can understand better. So you have already code to loop through bookmarks and fields and put values in it, and your problem is to know how you can read data from a file with VBA.
    Please keep in mind that VBA is nothing else then an Visual Basic 6.0 integrated in an Office application. So accessing files is restricted to the old Basic I/O procedures. You can find first information here.
    On the other hand, while working with VBA you can always use the Windows Scripting Host to read all lines of a text file into memory/into a variable, like this:

    Set fso=CreateObject("Scripting.FileSystemObject")
    If fso.FileExists(FileName) Then
       Set f=fso.OpenTextFile(FileName,1)
       Content=f.ReadAll
       f.close
       (rest ommitted)
    

    Afterwards you’re free to parse your text as you like it, e.g. using the Split function to convert all lines first into an array, and then to get the values from each line.

    There’s also the old approach to use the functions related to INI files; you may find this in some old handbooks. Here you should keep in mind that the Windows API function for INI files don’t read more than 256 characters after the = sign.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
In my XML file chapters tag has more chapter tag.i need to display chapters
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.