From: bryan on 18 Jan 2010 15:32 Since this template is locked and has formfields I'm assuming then that I could tap into other systems to the populate the formfields, Correct? Also, would it be auto(new) or document(new) ? Thanks, Bryan "Doug Robbins - Word MVP" wrote: > Use > > Set objWord = _ > objWordApp.Documents.Add("TemplateName") > > and then either have an AutoNew macro in the template that does the saving > or use > > objWord.SaveAs "path\filename" > > I would opt for the latter. > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "bryan" <bryan(a)discussions.microsoft.com> wrote in message > news:D1A3B9E9-5332-4A1F-9DBA-61D12FB828B8(a)microsoft.com... > > Jay, > > Is it possible to do this with a template as well and then auto running a > > macro to save it as a doc? > > > > Thanks, > > Bryan > > > > "Jay Freedman" wrote: > > > >> I'm not sure exactly where the problem is, but this appears to work > >> better: > >> > >> Dim objWordApp As Word.Application > >> Dim objWord As Word.Document > >> > >> Set objWordApp = CreateObject("Word.Application") > >> objWordApp.Visible = True > >> Set objWord = _ > >> objWordApp.Documents.Open(Filename:="C:\temp\openme.doc") > >> > >> -- > >> Regards, > >> Jay Freedman > >> Microsoft Word MVP FAQ: http://word.mvps.org > >> Email cannot be acknowledged; please post all follow-ups to the > >> newsgroup so all may benefit. > >> > >> > >> On Sun, 17 Jan 2010 15:58:01 -0800, eckert1961 > >> <eckert1961(a)discussions.microsoft.com> wrote: > >> > >> >Hello, > >> > > >> >I have a Word 2003 document that is opened from an Access 2003 function > >> >using the following command. > >> > > >> >Set objWord = GetObject("K:\My Documents\Winword\MailMerge\Email > >> >Receipt.doc", "Word.document") > >> > ' Make Word visible > >> > objWord.Application.Visible = True > >> > > >> >This document has an AutoOpen() macro but it doesn't run when it opens > >> >from > >> >Access. Once the doc opens, I can run the macro without any problem. If > >> >I > >> >open the document from Word the AutoOpen macro runs. > >> > > >> >Any idea of why this is happening? > >> . > >>
From: Fumei2 via OfficeKB.com on 18 Jan 2010 16:02 Yes you can action the formfields. If you are creating a document from a template then use Document_New in the template. bryan wrote: >Since this template is locked and has formfields I'm assuming then that I >could tap into other systems to the populate the formfields, Correct? > >Also, >would it be auto(new) or document(new) ? > >Thanks, >Bryan > >> Use >> >[quoted text clipped - 51 lines] >> >> >Any idea of why this is happening? >> >> . -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/word-programming/201001/1
From: bryan on 21 Jan 2010 10:48 Another question on this topic: Since I want to be able to tap into other systems to populate textfields, I need some info up front. Is it possible to pass in variable(s) on the auto(run)and have them placed in formfiled(s)? Once this info is there then I can sql other tables. Thanks again, Bryan "Fumei2 via OfficeKB.com" wrote: > Yes you can action the formfields. > > If you are creating a document from a template then use Document_New in the > template. > > bryan wrote: > >Since this template is locked and has formfields I'm assuming then that I > >could tap into other systems to the populate the formfields, Correct? > > > >Also, > >would it be auto(new) or document(new) ? > > > >Thanks, > >Bryan > > > >> Use > >> > >[quoted text clipped - 51 lines] > >> >> >Any idea of why this is happening? > >> >> . > > -- > Message posted via OfficeKB.com > http://www.officekb.com/Uwe/Forums.aspx/word-programming/201001/1 > > . >
From: bryan on 21 Jan 2010 12:40 Posting again as I do not see this post..... In order to get info from other systems, I need some info to start the sql with. Is it possible to pass in variable(s) when doing this: Set objWord = objWordApp.Documents.Add("TemplateName") Thanks, Bryan "Fumei2 via OfficeKB.com" wrote: > Yes you can action the formfields. > > If you are creating a document from a template then use Document_New in the > template. > > bryan wrote: > >Since this template is locked and has formfields I'm assuming then that I > >could tap into other systems to the populate the formfields, Correct? > > > >Also, > >would it be auto(new) or document(new) ? > > > >Thanks, > >Bryan > > > >> Use > >> > >[quoted text clipped - 51 lines] > >> >> >Any idea of why this is happening? > >> >> . > > -- > Message posted via OfficeKB.com > http://www.officekb.com/Uwe/Forums.aspx/word-programming/201001/1 > > . >
From: Peter Jamieson on 21 Jan 2010 13:19 I'm not completely sure what you are driving at, but... > Set objWord = objWordApp.Documents.Add("TemplateName") ....I guess it's obvious that the only "variables" in there - are - objWord - the mechanism you are using to create the new document - the template name, and by extension, anything that you can store in that template that you can then reference using VBA. In other words, if you want to access /different data/ depending on which /template/ you base your document on, then what you probably need to do is store the relevant connection information in your template. One way to do that would be create Word Document variables in your template that stored the information necessary to connect to a particular database and retrieve information from it. For example, suppose each template had two document variables as follows: a. DSConnection, storing an OLE DB connection string that would let you use ADO to open a particular SQL Server database b. DSCommand, storing a SQL SELECT statement that would let you open an ADO Recordset then you could use objWord.Variables("DSConnection") to extract the connection string, objWord.Variables("DSCommand") to extract the SQL (or whatever) statement, and use ADO to get the data you need. That would mean that each /template/ could be used to open a different data source. But if you need to do something different every time you create a new document, it isn't clear where the data is that would make you do thing "X" one time and thing "Y" the next - maybe you could try to spell that out. Peter Jamieson http://tips.pjmsn.me.uk On 21/01/2010 17:40, bryan wrote: > Posting again as I do not see this post..... > In order to get info from other systems, I need some info to start the sql > with. > > Is it possible to pass in variable(s) when doing this: > Set objWord = objWordApp.Documents.Add("TemplateName") > > > Thanks, > Bryan > > > "Fumei2 via OfficeKB.com" wrote: > >> Yes you can action the formfields. >> >> If you are creating a document from a template then use Document_New in the >> template. >> >> bryan wrote: >>> Since this template is locked and has formfields I'm assuming then that I >>> could tap into other systems to the populate the formfields, Correct? >>> >>> Also, >>> would it be auto(new) or document(new) ? >>> >>> Thanks, >>> Bryan >>> >>>> Use >>>> >>> [quoted text clipped - 51 lines] >>>>>>> Any idea of why this is happening? >>>>>> . >> >> -- >> Message posted via OfficeKB.com >> http://www.officekb.com/Uwe/Forums.aspx/word-programming/201001/1 >> >> . >>
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: A macro to increase line spacing Next: Calculation from results of form fields in VBA |