Prev: Runtime Error 509
Next: manipulating pdf files from vba
From: Laurel on 8 Feb 2006 13:37 Yess!!!! Bingo!!!! It's fixed!!!!! Thank you, thank you, thank you. What worked was to use the wdMergeSubTypeWord2000 parameter (8) for subtype in the Word 2003 environment. Strangely, using OpenDataSource2000 with the original parameter values did not fix it. It resulted in exactly the same error. Thanks for sticking with me!! "Peter Jamieson" <pjj(a)KillmapSpjjnet.demon.co.uk> wrote in message news:%23XzFMHBLGHA.2124(a)TK2MSFTNGP14.phx.gbl... >> This looks like you were actually working in a Word 2003 environment, > > Yes. I can also test in Word 2002 if necessary. But there have been > changes in this area in the various Word Service Packs as well. > >> specifying 2002 as a subtype. > > "Word 2000" in fact. The official documentation suggests that setting > Subtype to wdMergeSubtypeWord2000 means "use DDE." However, a reliable > source said that what it actually does is forces Word to use the same path > through code as Word 2000 uses, i.e. if the parameters make Word 2000 > would open using DDE, that's what Word 2003 will do, but if they make Word > 2000 open using ODBC, that's what Word 2003 will do. > > << >> My problem is I can't find the values for the constants available for the >> last parameter, "SubType" >>> > > You are not alone, as this particular parameter is poorly documented. In > the Word VBA Editor (VBE), you can see the documented values and the > associated integers using View|Object Browser (or press F2) then type > "subtype" (without the quotes) in the second text box (you can leave the > first text box saying "<All Libraries>" or change it to "Word"). Then > click the binocular button to the right of the text box. Everything should > be reasonably self-evident from that point, except for the fact that the > meanings of the various subtype values are not spelled out. The main point > is that to open an Excel sheet using OLEDB you probably need > wdMergeSubtypeOther (value 0) and for DDE or ODBC, use > wdMergeSubTypeWord2000. > > AFAIK the object browser works directly from Word's type library. > Incidentally, if you have a look in the list of Classes for MailMerge you > should be able to select OpenDataSource and click the definition. If you > right-click in the Object Browser and select Show Hidden Members, you will > see that there is actually a version of OpenDataSource with the same > parameters as OpenDataSource in Word 2000, called OpenDataSource2000. I > have never tried to use it, but maybe that help in this situation. > > Peter Jamieson > > "Laurel" <FakeMail(a)Hotmail.com> wrote in message > news:OyGCHTALGHA.2992(a)tk2msftngp13.phx.gbl... >> Thanks. Lots of good stuff here. See question below. >>> >>> The call I made when testing was more like: >>> >>> >>> ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument >>> ActiveDocument.MailMerge.OpenDataSource _ >>> "C:\mywb\Book1.xls", _ >>> wdOpenFormatAuto, _ >>> False, False, False, False, _ >>> "", "", _ >>> False, _ >>> "", "", _ >>> "Entire Spreadsheet", _ >>> "", "", False, wdMergeSubTypeWord2000 >>> >> >> This looks like you were actually working in a Word 2003 environment, >> specifying 2002 as a subtype. I would like to try this in my PB >> application, using different sets of parameters, depending on whether I'm >> running in Word 9 or Word 11. My problem is I can't find the values for >> the constants available for the last parameter, "SubType"). I don't know >> how to display them in the browser, and HELP in my copy of Word 2003 >> leaves it off. Here is "HELP" for OpenDataSource in Word 2003. Could you >> give me the value for "wdMergeSubTypeWord2000"? >> >> I stumbled on a way to see a list of acceptable parameter constants and >> their values, but I can't figure it out now. Could you also help me out >> with this? >> >> FROM HELP >> Attaches a data source to the specified document, which becomes a main >> document if it's not one already. >> >> expression.OpenDataSource(Name, Format, ConfirmConversions, ReadOnly, >> LinkToSource, AddToRecentFiles, PasswordDocument, PasswordTemplate, >> Revert, WritePasswordDocument, WritePasswordTemplate, Connection, >> SQLStatement, SQLStatement1, OpenExclusive) >> >> >> >> > >
From: Peter Jamieson on 8 Feb 2006 17:24 << > Thanks. The value is 8. I'll let you know what happens. Just wanted to > post this quick question. I was able to get the list of valid constants > for the SubType parameter just fine, but I wasn't able to find out what > their actual numeric values were. To do that I had to write a little > macro, put a break at the last statement and examine the value of itest. > Is there another way? As I mentioned before, I had stumbled on a method > to find the value of a constant.... But maybe this was what I did. It's > all such a blur right now. Is there a simpler way? >> Glad you got it to work!Forgot to give the constant value to you but in fact we'd been through that issue before, so I'd be interested to know what the difference was if you can spot it. The simpler way in the VB Editor is to find the constant you want in the object browser and select it. The bottom pane of the object browser gives some information about the object/constant etc., in this case: Const wdMergeSubTypeWord2000 = 8 Member of Word.WdMergeSubType It's usually pretty quick to select the other values in the enumeration and find out their numeric values at the same time. Thanks for the feedback about he OpenDataSource2000 call not working in this case. Peter jamieson "Laurel" <FakeMail(a)Hotmail.com> wrote in message news:%23XoDDoMLGHA.2012(a)TK2MSFTNGP14.phx.gbl... >> You are not alone, as this particular parameter is poorly documented. In >> the Word VBA Editor (VBE), you can see the documented values and the >> associated integers using View|Object Browser (or press F2) then type >> "subtype" (without the quotes) in the second text box (you can leave the >> first text box saying "<All Libraries>" or change it to "Word"). Then >> click the binocular button to the right of the text box. Everything >> should be reasonably self-evident from that point, except for the fact >> that the meanings of the various subtype values are not spelled out. The >> main point is that to open an Excel sheet using OLEDB you probably need >> wdMergeSubtypeOther (value 0) and for DDE or ODBC, use >> wdMergeSubTypeWord2000. > > Thanks. The value is 8. I'll let you know what happens. Just wanted to > post this quick question. I was able to get the list of valid constants > for the SubType parameter just fine, but I wasn't able to find out what > their actual numeric values were. To do that I had to write a little > macro, put a break at the last statement and examine the value of itest. > Is there another way? As I mentioned before, I had stumbled on a method > to find the value of a constant.... But maybe this was what I did. It's > all such a blur right now. Is there a simpler way? > > Sub wtest() > ' > ' wtest Macro > ' Macro created 2/8/2006 by Laurel > ' > Dim itest As Integer > Dim sdebug As String > > itest = wdMergeSubTypeWord2000 > > sdebug = "stop" > End Sub >
From: Laurel on 9 Feb 2006 08:42
"Peter Jamieson" <pjj(a)KillmapSpjjnet.demon.co.uk> wrote in message news:%23p3a65PLGHA.1312(a)TK2MSFTNGP09.phx.gbl... > Glad you got it to work!Forgot to give the constant value to you but in > fact we'd been through that issue before, so I'd be interested to know > what the difference was if you can spot it. > > The simpler way in the VB Editor is to find the constant you want in the > object browser and select it. The bottom pane of the object browser gives > some information about the object/constant etc., in this case: Yup, that works. The difference was that I simply wasn't looking at the bottom of the screen. I was remote connected to another computer and had to scroll around to see all the desktop, so that probably contributed. Thanks again. > > Const wdMergeSubTypeWord2000 = 8 > Member of Word.WdMergeSubType > > It's usually pretty quick to select the other values in the enumeration > and find out their numeric values at the same time. > > Thanks for the feedback about he OpenDataSource2000 call not working in > this case. > > Peter jamieson > "Laurel" <FakeMail(a)Hotmail.com> wrote in message > news:%23XoDDoMLGHA.2012(a)TK2MSFTNGP14.phx.gbl... >>> You are not alone, as this particular parameter is poorly documented. In >>> the Word VBA Editor (VBE), you can see the documented values and the >>> associated integers using View|Object Browser (or press F2) then type >>> "subtype" (without the quotes) in the second text box (you can leave the >>> first text box saying "<All Libraries>" or change it to "Word"). Then >>> click the binocular button to the right of the text box. Everything >>> should be reasonably self-evident from that point, except for the fact >>> that the meanings of the various subtype values are not spelled out. The >>> main point is that to open an Excel sheet using OLEDB you probably need >>> wdMergeSubtypeOther (value 0) and for DDE or ODBC, use >>> wdMergeSubTypeWord2000. >> >> Thanks. The value is 8. I'll let you know what happens. Just wanted to >> post this quick question. I was able to get the list of valid constants >> for the SubType parameter just fine, but I wasn't able to find out what >> their actual numeric values were. To do that I had to write a little >> macro, put a break at the last statement and examine the value of itest. >> Is there another way? As I mentioned before, I had stumbled on a method >> to find the value of a constant.... But maybe this was what I did. It's >> all such a blur right now. Is there a simpler way? >> >> Sub wtest() >> ' >> ' wtest Macro >> ' Macro created 2/8/2006 by Laurel >> ' >> Dim itest As Integer >> Dim sdebug As String >> >> itest = wdMergeSubTypeWord2000 >> >> sdebug = "stop" >> End Sub >> > > |