A user of mine is having issues importing from Excel and
I cannot debug. OfficeXP, Access2000, Excel(8).
Here is the code, which for the life of me I cannot
figure out what is not working:
Dim myXL As Excel.Application
Dim myWB As Workbook
Dim myWS As Worksheet
Set myXL = GetObject(, "Excel.Application")
****at this poing myXL is valid
strFullName = Me.txtDefaultPath.Value
Set MyWB = myXL.Workbooks.Open(strFullName)
Set myWS = MyWB.Worksheets(1)
****at this point, myWB and myWS are equal to Nothing.
Can't figure out why. Any help is appreciated. Thanks!
John Nurick - 14 Sep 2004 20:59 GMT
Hi Sarah,
This would happen if error handling has been turned off with
On Error Resume Next
and strFullName is not the filespec of an Excel workbook.
If that's not the problem, try using
Set myXL = CreateObject("Excel.Application")
If that works, it suggests there's something odd about the running
instance of Excel that's being found by the GetObject() call.
>A user of mine is having issues importing from Excel and
>I cannot debug. OfficeXP, Access2000, Excel(8).
[quoted text clipped - 14 lines]
>****at this point, myWB and myWS are equal to Nothing.
>Can't figure out why. Any help is appreciated. Thanks!
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
Sarah - 15 Sep 2004 19:18 GMT
Thank you. In fact, error handling was turned off. Of
course there was also an issue with the way the "get UNC
path" was retreiving the spreadsheet, which inadvertently
effected this import process.
Thanks for your reply.
>-----Original Message-----
>Hi Sarah,
[quoted text clipped - 32 lines]
>Please respond in the newgroup and not by email.
>.
bbttyy - 24 Sep 2004 03:26 GMT
"Sarah" <Sarah@discussions.microsoft.com>
??????:1f7301c49a73$4ffa8070$a501280a@phx.gbl...
> A user of mine is having issues importing from Excel and
> I cannot debug. OfficeXP, Access2000, Excel(8).
[quoted text clipped - 14 lines]
> ****at this point, myWB and myWS are equal to Nothing.
> Can't figure out why. Any help is appreciated. Thanks!