From: eckert1961 on 17 Jan 2010 18:58 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? -- Regards, Chris
From: Jay Freedman on 17 Jan 2010 22:40 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: eckert1961 on 18 Jan 2010 00:18 Hi Jay, Your recommendation resolved the issue. Thank you for your assistance. -- Regards, Chris "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: bryan on 18 Jan 2010 13:54 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: Doug Robbins - Word MVP on 18 Jan 2010 14:40 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? >> . >>
|
Next
|
Last
Pages: 1 2 3 Prev: A macro to increase line spacing Next: Calculation from results of form fields in VBA |