?
Solved

Sending Info from VB/VBA to MSWord

Posted on 2002-06-10
8
Medium Priority
?
210 Views
Last Modified: 2011-09-20
I have looked but not found too much good info on VB/VBA interface with MS Office products. This is what I am trying to do: I have a word document that has bookmarks for the fields that I want to populate. I want to populate these bookmarks but with some of the fields in barcode and some in human readable fonts. Than I want to print this out. It would be better if it did not have to be visible. Thanks in advance. This is a hard question for me so it is a 200 pointer.
0
Comment
Question by:RBrown7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 22

Accepted Solution

by:
rspahitz earned 800 total points
ID: 7068562
I'm not exactly sure of the question, but the standard solution is to turn on the macro record, perform the function manually, then turn off the recorded.  You will then have a function to perform the manual process automatically.

Sometimes the macro needs modifying so that you can perform some enhanced function.  This is where the VBA knowledge becomes important, but most of what you need is not how to use Word, but how to use Visual Basic.
0
 
LVL 3

Expert Comment

by:n_narayanan
ID: 7068985
For Book mark get help from,

http://www.freevbcode.com/ShowCode.ASP?ID=2100

0
 

Author Comment

by:RBrown7
ID: 7072900
Maybe a little more specific information from me would be helpful. I am using the Word object in the References and have been able to open an instance of word from my VB code. I have also been able to move information from the code to the word object using bookmarks in the word document that I am calling through code. The problem I am having is setting the fonts for the individual bookmarks. I need to see an example of the syntax of the code that will set the font for the individual bookmarks.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:rspahitz
ID: 7073163
Unless I'm missing your definition of bookmark, I don't think Word bookmarks have fonts; they are merely reference points with names.

However, if you have Word, I'd open it and try to reproduce everything in VBA first, then copy/paste the code into VB.  This would allow you to record whatever you want and end up with valid code to be copied.
0
 

Author Comment

by:RBrown7
ID: 7073221
Well, if I can't manipulate the bookmark font, can I manipulate something else? A Range maybe? I just want to make sure that the information that I am putting into the Word Document is going to come out the way I want it. I know that there is a Font property in the Object model, I just don't know if is going to apply to the whole document or to a specific sentence, paragraph or if possible, a bookmark.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7073278
As far as I know, the font properties are attached to the individual characters.  You apply it to one or more characters by using the "selection" object.

Do you have Word?  If so, jump into there, create a macro where you set the font of a single or multiple characters, and look at the VBA code so you can see how it looks/works.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7899892
Hi RBrown7,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rspahitz's comment(s) as an answer.

RBrown7, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7967374
Comment from expert accepted as answer

Computer101
E-E Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question