Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 3rd, 2007, 11:07 PM
Registered User
 
Join Date: Jul 2004
Location: Auckland, , New Zealand.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Open document, Open second doc and copy to first

Hi,
so far I have the following.
    'check whether to create a new word instance or use an existing session
    WordRunning = IsWordRunning
    If WordRunning Then
        Set WordApp = GetObject(, "Word.Application")
        Else
        Set WordApp = New Word.Application
        End If

    'open up the reference document
    Set WordDoc = WordApp.Documents.Open("C:\Database\25KgPowder\Bas e.doc") '
    With WordApp
    .Visible = True
    .WindowState = wdWindowStateNormal
    End With

    'check on the access form which controls are active
    'open that section document
    'copy it
    'and then paste it after the book mark in the reference document

    If (Me![Section11]) = True Then
    'do something
    Set WordDoc =
WordApp.Documents.Open("C:\Database\25KgPowder\Sec tion11.doc")
    'copy contents for pasting into original document
    '???????????????????

    'close the "Section11" document as not required anymore

    '?????????????????????????????

    'paste this section to the template
    'bring original document to focus
    'locate the bookmark and paste section11
    Set WordDoc = WordApp.Documents.Open("C:\Database\25KgPowder\Bas e.doc")
    Set WordDoc = WordApp.ActiveDocument
    Set WordRng = WordDoc.GoTo(what:=wdGoToBookmark, NAME:="frmBookmark")
    'paste


    Else
    'do something
    End If

The if statements continue for another 10 conditions.

I am automating from access 2000.
I open an existing document and if the access controls on the form are true,
add sections to the existing document.
How do I copy the second documents contents and add it to the original
document after the bookmark in the original document?
Then I want to close the second documnets session and move on to add
another section if the next access control is true.
Regards
Bill
Reply With Quote
  #2 (permalink)  
Old March 7th, 2007, 02:47 AM
sks sks is offline
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there,

I know reading/writing of document in VB, .Net
But due to lack of exact file format, and unavailaibilty of enough documentation for Doc file format
i dont know how to extract the Section, bulletin in Word Doc.

I want to search a particular text in a Word Document, & i need to extract the session, or bulletin (in number format) for e.g. if my text to be searched is "TEstData123"
& if it is present in say in section 1.2, 3.2.1, 4.2.3.1, 5.1 .... and so on
So wherever it is present i need to extract all these sections(1.2, 3.2.1, 4.2.3.1, 5.1 .... ) as an output

So would any one plz help me in doing so

Eagerly waiting for help
Thanks in Advance :)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Open A Word Doc... using ASP .net nikks9 ASP.NET 1.0 and 1.1 Professional 8 March 31st, 2015 03:45 AM
how to open a Doc from java raju_vv Servlets 1 May 28th, 2007 07:24 AM
Help need to geneate word doc in open office satyakishore Servlets 0 March 16th, 2006 04:14 AM
PROBLEM TO OPEN XML DOC IN 98SE chanti XML 0 August 9th, 2004 06:42 AM
How to open a .DOC file with MS-Word ? sherbir Servlets 0 July 26th, 2004 02:39 AM



All times are GMT -4. The time now is 09:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.