Trying to use Excel to "program" word doc

E

Eric

Hello Group,

I am trying to use vba code from an excel worksheet to load data at
bookmarks on a word doc. That seems to be ok it the bookmarks are
defined in the word doc.

I thought I would try to run some sub proc and functions (in vba Excel
side) to add booksmarks to the word document (from subs, etc in excel)
and then put data on them, move a line or 2 or 3 down, and add more
bookmarks, etc.

Been having trouble doing this, particularly to add a bookmark, etc.

Does this make sense? or should I put code in the Word doc, that pulls
the data from Excel???

Any ideas will help
 
G

Guest

Personally, it is the code writer's choice. I have written in both and my
preference is Excel. But I have not done anything with bookmark, I was just
composing letters and adding data in at certain points.
 
H

Helmut Weber

Hi Eric,
Does this make sense? or should I put code in the Word doc, that pulls
the data from Excel???

that's just about the same.

The only thing you have to think about
is where the data from Excel should be placed in Word.
Working with lines is not a good concept,
as lines are recalculated on the fly
and depend on the selected printer,
on fonts available, on font substitution etc...

You may place the data at the n-th character of a doc,
before it, after it, or replace it,
at the start on the n-th section,
at the start on the n-th paragraph,
n characters after the start of paragraph x,
uncountable ways.


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
G

Guest

Hi Eric,
I have the same thing to do. i.e. Make an word document from excel data. I'm
wondering if you've got to do that?
Thanks!
Alex
 
E

eholz1

Alex said:
Hi Eric,
I have the same thing to do. i.e. Make an word document from excel data. I'm
wondering if you've got to do that?
Thanks!
Alex
Hello Alex,

I got it all to work. It may not be elegant, there is always room for
improvement.
I am able to to all that i need to do.
I use a template for starters, with styles set
I use the Excel worksheet to hold the data that ends up in the Word
document.
I have functions and sub procedures that transfer the data, and create
the formats, etc.

If you need more info on this (or a copy of the excel workbook, and the
word template),
let me know.
I will check the group's posting later on.

thanks,

eric
 
G

Guest

Hi Eric,
Yes, I have the same work to do. I wanted to make a mailmerge from excel but
finally, I have decided to start from zero and create the word document and
style from excel. Last week, I have learned how to program with Word (set
object and add text with oRange.InsertAfter) If you want to send me your
file, I'll appreciate! My address is alexstpierre a.t h.o.t.m.a.i.l
Thank you!
Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top