Alpha Video Training
Results 1 to 6 of 6

Thread: Open Word, Add text, save and close Word

  1. #1
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    4,163

    Default Open Word, Add text, save and close Word

    Is there a way to get text to the clipboard [like :clipboard_set_data()], Open a Word document (like sys_open()), paste the clipboard data to the end of the Word document, save the Word document, close the Word document.... from Alpha? I found this:
    http://msgboard.alphasoftware.com/al...ight=Open+word
    but I don't think this is the same because I'm retrieving an existing document not creating a new one.
    Last edited by Mike Wilson; 02-22-2010 at 11:29 PM.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Open Word, Add text, save and close Word

    To open and existing document...


    Code:
    Dim wordApp As p	
    	wordApp = ole.Create("Word.Application")
    	wordApp.WindowState = 1 'wdWindowStateMaximize
    	wordApp.Documents.Open(docname)
    The rest should be the same.
    There can be only one.

  3. #3
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    4,163

    Default Re: Open Word, Add text, save and close Word

    Thanks Stan. That get's me half way there. Now I'll have to figure out how to save the Word document changes and close Word. I'll work on the macro->VB placed into xbasic that you wrote about. This is really so far over my head.... but I chipping away.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Open Word, Add text, save and close Word

    wordApp.ActiveDocument.SaveAs(docName)

    Docname can be the same as the opened document or can be a new name to preserve the original file.
    There can be only one.

  5. #5
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    4,163

    Default Re: Open Word, Add text, save and close Word

    Thanks Stan.

    I'm trying to generate a sequence where a record in Alpha that holds the information (including file name) regarding a policy that is written in Word can be registered as signed off by me in Alpha, and my name and date is added to that existing Word document. Open, edit/add, save, close.. in the background, with a password-protected button push in alpha. So I have the open, edit part... maybe now the save part, Now I need the close part.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Open Word, Add text, save and close Word

    WordApp.Quit()
    delete WordApp 'just deletes the pointer variable
    There can be only one.

Similar Threads

  1. How do you open say a word document
    By reedallenbrown in forum Application Server Version 9 - Web/Browser Applications
    Replies: 1
    Last Post: 06-23-2008, 06:07 PM
  2. Microsoft Word Merge with Word 2007
    By Brad Chesnut in forum Alpha Five Version 8
    Replies: 3
    Last Post: 04-28-2008, 01:36 PM
  3. Save to MS Word but Wrong Record
    By forskare in forum Alpha Five Version 8
    Replies: 6
    Last Post: 04-05-2007, 11:54 AM
  4. Open a word doc
    By fgpylant in forum Alpha Five Version 7
    Replies: 4
    Last Post: 05-09-2006, 02:49 PM
  5. OLE with WORD leaves Word OPEN
    By richkerr in forum Alpha Five Version 6
    Replies: 14
    Last Post: 09-08-2005, 04:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •