That did it. Thanks, Dan
On 6/24/2004 12:00 PM, Dave Jones wrote:
> Try:
> Set Mybook=objXL.Workbooks.Add("C:\Test\Mybook.xls")
>
> Dave
>
> "Dan" <dan@nospam..com> wrote in message
> news:(E-Mail Removed)...
>
>>I actually want to open an existing workbook, say c:\test\mybook.xls,
>>and assign it to object variable to manipulate. I can't seem to get the
>>syntax correct...
>>
>>
>>On 6/23/2004 5:51 PM, Dave Jones wrote:
>>
>>>Try:
>>>
>>>On Error Resume Next
>>>Set objXL = GetObject(, "Excel.Application")
>>>Err.Clear
>>>If objXL Is Nothing Then
>>> Set objXL = CreateObject("Excel.Application")
>>> End If
>>>Set Mybook = objXL.Workbooks.Add
>>>
>>>And then you can access the workbook using:
>>>Mybook.Sheets("Sheet1").Select
>>>And then access that sheet as follows:
>>>objXL.Rows("1").Select
>>>objXL.Selection.Font.Bold = True
>>>
>>>Dave
>>>
>>>"Dan" <dan@nospam..com> wrote in message
>>>news:(E-Mail Removed)...
>>>
>>>
>>>>Using Access 2003 VBA, how do I open a Excel Workbook and then assign it
>>>>to an Excel.Workbook object variable so it is easily referenced?
>>>>
>>>>TIA,
>>>>Dan
|