Excel not showing in Windows 7 but does in XP

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: Excel not showing in Windows 7 but does in XP

Post by Pat »

A further light on this, when they double click on the MDE file in windows explorer it WORKS and shows the excel sheet.

When they run the .BAT file which copies the MDE file from the server to their userprofile folder, then tries to run the MDE from their userprofile it does NOT work in that it doesn't show the excel sheet.

Ideas anyone?

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel not showing in Windows 7 but does in XP

Post by HansV »

Is the Excel workbook being created at all?
What is the value of the variable sPathFn?
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: Excel not showing in Windows 7 but does in XP

Post by Pat »

yes the excel file is being created.
the variable sPathFn holds the correct path as the mdb file works.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel not showing in Windows 7 but does in XP

Post by HansV »

I know that the .mdb file works, but I was wondering whether the .xls file was actually created when the user opens the .mde file using the .bat file.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: Excel not showing in Windows 7 but does in XP

Post by Pat »

Yes it creates the excel file ok from the MDE file when it is entered from a bat file. It just doesn't show the excel file.
here is the code:

Code: Select all



    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, sQ, sPathFn, True
    ''''DoCmd.TransferSpreadsheet acExport, , sQ, sPathFn, True
    Dim objapp As Object
    Dim objwb As Object
    Dim objsh As Object
    
    Set objapp = CreateObject("Excel.Application")
    objapp.Visible = True
    
    Set objwb = objapp.Workbooks.Open(sPathFn)
    Set objsh = objwb.Sheets(1)
    
    objsh.Rows(1).Insert
    
    objsh.Cells(1, 1) = sH
    
    objwb.Save
    objapp.Visible = True
    
    Set objsh = Nothing
    Set objwb = Nothing
    Set objapp = Nothing

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel not showing in Windows 7 but does in XP

Post by HansV »

I'm afraid I'm stumped. I have no idea why the workbook is opened when the .mde is opened directly but not when the .mde is opened from a batch file.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: Excel not showing in Windows 7 but does in XP

Post by Pat »

Thanks Hans, i am as frustrated as you, probably more. These types of problems really start to piss me off.