From: Dennis on 29 Mar 2010 14:35 Open up the VBA code window. Then click on Tools / Refenrences. a HUGE (and I do mean HUGE) list of references to various libraries will be displayed. Scroll down until you find the one(s) for Microsoft Word (thank GOD they're in alphabetical order) and click in the select box. Then save your VBA code and the reference will save with it. Then you have all those methods at your disposal. You'll need to play with them, as I don't remember how to use them (it was about 4 years ago that I had to do it). But with that reference selected, you have ALL the functionality of MS Word at your fingertips. You can even change document formatting, Search for specifi text, do find/Replaces, etc. It's way cool (heh)... "davidtyler via AccessMonster.com" wrote: > Dennis - I feel you past pain - been going through the same thing myself - so > I really appreciate your response - been 'FileCopy' and 'Name As' waterlogged > and haven't been able to figure out automating SelectAll and Copy > > so..... how do I add a reference to the MS Word Library? > > Dennis wrote: > >Well, in VBA you need to add a reference to the MS Word Library. That exposes > >all the MS Word functionality to your Access database. you can open a Word > >doc ("invisibly" if you want, so the user doesn't see a Word aplpication > >window open), "Select All" text, "Copy" that text, etc. Once you have all > >those methods available to your VBA code, it becomes a simple mechanical > >exercise. I spent MONTHS on this (gag) back when I had to learn how to do > >it... > > > >Dennis > > > >> can't figure how to use only macros to accomplish this - even VBA code help > >> would be great - thanks > >[quoted text clipped - 6 lines] > >> >> > >> >> . > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1 > > . >
From: davidtyler via AccessMonster.com on 29 Mar 2010 15:06 will give it a try - thanks so much Dennis wrote: >Open up the VBA code window. Then click on Tools / Refenrences. a HUGE (and I >do mean HUGE) list of references to various libraries will be displayed. >Scroll down until you find the one(s) for Microsoft Word (thank GOD they're >in alphabetical order) and click in the select box. Then save your VBA code >and the reference will save with it. Then you have all those methods at your >disposal. You'll need to play with them, as I don't remember how to use them >(it was about 4 years ago that I had to do it). But with that reference >selected, you have ALL the functionality of MS Word at your fingertips. You >can even change document formatting, Search for specifi text, do >find/Replaces, etc. It's way cool (heh)... > >> Dennis - I feel you past pain - been going through the same thing myself - so >> I really appreciate your response - been 'FileCopy' and 'Name As' waterlogged >[quoted text clipped - 17 lines] >> >> >> >> >> >> . -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1
From: PieterLinden via AccessMonster.com on 29 Mar 2010 16:52 davidtyler wrote: >will give it a try - thanks so much > >>Open up the VBA code window. Then click on Tools / Refenrences. a HUGE (and I >>do mean HUGE) list of references to various libraries will be displayed. >[quoted text clipped - 12 lines] >>> >> >> >>> >> >> . I just tried this... PAINFULLY SLOW. Wonder if it works better with ADO??? Private Sub cmdChooseWordDoc_Click() Dim strFile As String Dim appWord As Word.Application Dim docWord As Word.Document strFile = GetOpenFile("C:\", "choose a file") Me.txtFolder = strFile Set appWord = New Word.Application 'use get appWord.Documents.Open strFile Set docWord = appWord.Documents(strFile) Me.txtContents = docWord.Content docWord.Close False Set docWord = Nothing appWord.Quit Set appWord = Nothing End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1
From: davidtyler via AccessMonster.com on 30 Mar 2010 07:22 Dennis & Pieter I'm trying th folloing code but cannot get the text to copy HELP :) Private Sub Command10_Click() On Error GoTo Err_Command10_Click ' Now we open the canned response Dim objWord As Word.Application Set objWord = New Word.Application objWord.Visible = True objWord.Documents.Open "C:\testworddoc.doc""" ' Select and Copy objWord.Activate Selection.WholeStory Selection.Copy Selection.End = True ' Then we just need to close the canned response objWord.Activate objWord.Quit Exit_Command10_Click: Exit Sub Err_Command10_Click: MsgBox Err.Description Resume Exit_Command10_Click PieterLinden wrote: >>will give it a try - thanks so much >> >[quoted text clipped - 3 lines] >>>> >> >> >>>> >> >> . > >I just tried this... PAINFULLY SLOW. Wonder if it works better with ADO??? > >Private Sub cmdChooseWordDoc_Click() > Dim strFile As String > Dim appWord As Word.Application > Dim docWord As Word.Document > > strFile = GetOpenFile("C:\", "choose a file") > Me.txtFolder = strFile > > Set appWord = New Word.Application 'use get > appWord.Documents.Open strFile > Set docWord = appWord.Documents(strFile) > Me.txtContents = docWord.Content > > docWord.Close False > Set docWord = Nothing > appWord.Quit > Set appWord = Nothing > >End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1
From: Dennis on 30 Mar 2010 13:58 How do you know the Copy isn't working? "davidtyler via AccessMonster.com" wrote: > Dennis & Pieter > I'm trying th folloing code but cannot get the text to copy > HELP :) > > Private Sub Command10_Click() > On Error GoTo Err_Command10_Click > > ' Now we open the canned response > Dim objWord As Word.Application > Set objWord = New Word.Application > objWord.Visible = True > objWord.Documents.Open "C:\testworddoc.doc""" > > ' Select and Copy > objWord.Activate > Selection.WholeStory > Selection.Copy > Selection.End = True > > ' Then we just need to close the canned response > objWord.Activate > objWord.Quit > > > Exit_Command10_Click: > Exit Sub > > Err_Command10_Click: > MsgBox Err.Description > Resume Exit_Command10_Click > > > > PieterLinden wrote: > >>will give it a try - thanks so much > >> > >[quoted text clipped - 3 lines] > >>>> >> >> > >>>> >> >> . > > > >I just tried this... PAINFULLY SLOW. Wonder if it works better with ADO??? > > > >Private Sub cmdChooseWordDoc_Click() > > Dim strFile As String > > Dim appWord As Word.Application > > Dim docWord As Word.Document > > > > strFile = GetOpenFile("C:\", "choose a file") > > Me.txtFolder = strFile > > > > Set appWord = New Word.Application 'use get > > appWord.Documents.Open strFile > > Set docWord = appWord.Documents(strFile) > > Me.txtContents = docWord.Content > > > > docWord.Close False > > Set docWord = Nothing > > appWord.Quit > > Set appWord = Nothing > > > >End Sub > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1 > > . >
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Office 2010 beta issues Next: open a form at a certain time |