?
Solved

Copy From one word doc to other & Passing Value to word from VB

Posted on 2003-04-01
10
Medium Priority
?
121 Views
Last Modified: 2010-05-01
How  to copy "a page" from one word document to other word document from VB6 code.
And
How to pass the values to the WORD documents from visual basic source.
Its already predefined letter document.
i need to pass only the address to the approprite fields.
how to do that.

0
Comment
Question by:mmv1
[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
10 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 8245811
Hi mmv1

First question:
I suggest that through code you higlight (select) the text in the first document, copy to clipboard then paste it in the other one.
Please let me know if you have trouble writing this code

Second question:
When you say fields, do you mean form fields?

Dabas
0
 

Author Comment

by:mmv1
ID: 8251571
1. S, i dont know how to do the select a PAGE and Copy to the New Word Document(New.Doc). Bcas i have 20word documents. I need to open a Empty Document and open the 1.doc to Copy and Paste in the "New.DOC" first page. And after that i need open 3.doc and copy and paste into the Next page of "New.Doc".

2.  I have some default setting for the letter format.
In the Address line 1,2,3,4,5 etc i will get from the Database. so that i will send the real values from VB to the word document and make that letter completed.
ie.i am not sending the whole word document from vb just sending 5 to 6 Values.
 
0
 
LVL 27

Accepted Solution

by:
Dabas earned 300 total points
ID: 8257351
1) How to determine that you are selecting a page.
I assume you have the cursor on the desired page.
I could not find a "CurrentPage" property in Word's object browser, but there is a PageNumber one.
I would suggest that you move your selection backword, possibly a word at a time, until you have either reached the beginning of the document, or a place where the pagenumber is different. You start your selection there, then move forward until you reach end of document or next page. You go back one character to the previous page, copy, ready to paste into the other document

2) If the lines you want to copy over come from the database, why not pass the values directly from the database?

Dabas
0
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!

 

Expert Comment

by:CleanupPing
ID: 8531197
Hi mmv1,
This old question (QID 20570059) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 8571131
A request for deletion or PAQ has been made.  If no response or you feel this is in error, comment.  If no objection, I or another Moderator will handle this question in three days.

Computer101
E-E Admin
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8571273
Note to Moderator:
I disagree with the request.
The question was answered, a clarification asked, and answered again. mmv1 had the opportunity to ask for further clarification or explain why my answer did not help

Dabas
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8580826
Dabas,

I am in agreement. The question will not be deleted; however, it appears that the user has a duplicate account, so it will be a day or two before I finalize this question. Feel free to leave a comment here in a day or so if it isn't closed.

Netminder
EE Admin
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8597342
Netminder,
> Feel free to leave a comment here in a day or so if it isn't closed.

I feel free. :-)

Dabas
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8599966
Free at last, free at last, thank ... oh, wait... wrong forum... *grin*

I've force-accepted to close the question.

Netminder
EE Admin
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8600820
Netminder,
Thanks Freely! :-)}

Dabas
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 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