By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 2,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

Adding state flags to a Word merge doc in Access VBA

P: 443
Ok, I have a state table that I would like to add the state flag to it.
After I have the flag in the table I would like to be able to create a merge file .txt that I could place the flag in so I could put it on a badge label using the mail merge option in Word. The customer file has the state code so when I create the merge file .txt I can put the state flag in that file, so it will display on the badge label.
Hopefully someone can lead me in the right direction.
May 5 '17 #1
Share this Question
Share on Google+
5 Replies

Expert 100+
P: 1,107
I think a lot of how to approach this depends on how you are planing to perform the Mail Merge. Has that process been defined yet, or are you still in control of the Word Document creation?
May 5 '17 #2

P: 443
I've created the word doc but could change it if necessary. I have an option in my program to create the labels, the program creates a .txt file that will feed the mail merge. My program starts Word and calls the labelwstate.doc, then the user has to select the mail merge option in word to complete the merge. The .txt file that my program creates has all the information needed for the merge, but I need to add the state flags. I'm hoping that the state flag can be included in the .txt file and will put the flag on the label. I have the state flags as a .jpg file.aa
May 5 '17 #3

Expert 100+
P: 1,107
Since you've already gotten to this point in your coding, this link seems to be the best way that I've seen use and image in a Word Merge: Is it possible to mail merge an image?

The other way that should work, is to have some VBA code to create your Document from scratch, but again, it seems like you are nearly complete with this aspect of your project.
May 6 '17 #4

P: 443
Ok, not sure how to get your first option working, I've would like to try your second option. I have a report setup for the badges so the user can have an option to print them from the program if they don't have MS Word.
So how do I get the correct flag into a regular report?
Again thanks for your help.
May 6 '17 #5

Expert 100+
P: 1,107
OK, if you want to do it in a Access Report instead of Word, that's much easier.

I have a situation that is similar where we want to display a signature on the Report. This is a stripped down version of the code that is placed in the GroupFooterFormat Event:
Expand|Select|Wrap|Line Numbers
  1. Dim sSignatureFile As String
  2. sSignatureFile = Nz(Me![SignatureFile], "")
  4. If Len(sSignatureFile) > 0 Then
  5.     sSignatureFile = gResourceDirectory & "\Signatures\" & sSignatureFile
  6.         If fileExists(sSignatureFile) Then
  7.         Me.imgSig.Visible = True
  8.         Me.imgSig.Picture = sSignatureFile
  9.     Else
  10.         Call msgBoxError("Could not find the Signature file at: " & sSignatureFile)
  11.     End If
  12. End If
May 8 '17 #6

Post your reply

Sign in to post your reply or Sign up for a free account.