Re: How to find worksheet by Russ
Russ
Sat Aug 04 01:32:46 CDT 2007
I typed in opendatasource into Word VBA Help and the opendatasource method
help had this snippet of help for the connection parameter:
****Quote
Connection Optional Variant. A range within which the query specified by
SQLStatement is to be performed. How you specify the range depends on how
data is retrieved. For example:
? When retrieving data through ODBC, you specify a connection string.
? When retrieving data from Microsoft Excel using dynamic data exchange
(DDE) (Windows only), you specify a named range.
? When retrieving data from Microsoft Access (Windows only), you specify
the word "Table" or "Query" followed by the name of a table or query.
****UnQuote
So create a named range for the worksheet data in Excel and pass that as the
Connection parameter. And maybe a SQLStatement query on that range is not
actually needed, so try it first without using a SQLStatement.
> path shows up as you stated all I need is to get into file for a worksheet it
> is a Excel worksheet in Parade.xls
>
> "Russ" wrote:
>
>> One trick that I like to use to get a path, is to open a Dos window and
>> separately through Windows Explorer go to a file, then drag and drop that
>> file from Explorer on top of the Dos window. The full path to that file will
>> appear in the Dos window and you can copy it to the clipboard for pasting.
>> This works great for network paths, too.
>> To open a Dos window, go to Start button in Windows, click on Run, enter
>> cmd.
>>
>>> Have an Excel workbook trying to use a worksheet in the workbook for mail
>>> merge. Know its my code . will not locate (MailE.xls) as data source. Here
>>> is
>>> code line. Will some one hit me in the face so I can see what I am missing.
>>> Excel folder is Parade also Parade is file in folder Have tried
>>> "C:\parade\parade\MailE.xls" ThankMailE is merge doc.
>>> Thanks
>>>
>>> ChangeFileOpenDirectory "C:\Parade"
>>> Documents.Open FileName:="ThankMailE.doc", ConfirmConversions:=False, _
>>>
>>>
>>> ActiveDocument.MailMerge.OpenDataSource Name:="C:\Parade.xls\MailE.xls",
>>>
>>
>> --
>> Russ
>>
>> drsmN0SPAMikleAThotmailD0Tcom.INVALID
>>
>>
--
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID