Information générale
Catégorie:
Codage, syntaxe et commandes
Actually, it's two .VBPs, the one is an activeX Dll server component
My .VBP has the following contents:
frmGroupDlg
frmGTPAdd
frmGTPEdit
frmGTPDelete
frmGTPRep
frmReport
Module1.bas
SrvrApp.vbp has as a class module the file:
clsSrvr.cls - this handles connections to the databases by making disconnected recordsets
By the way, I just tried it on another pc with Excel2000 and Visual Studio 6.0 and the error is encountered also! Everything is functioning when I'm on my pc. But when I try the app in another pc, when I click a command button in frmGTPRep that's the only time the error occurs.
Perhaps, I thought it might be that I have to use the Package and Deployment Wizard. I tried packaging the app, and everything works fine except when it comes to the button at frmGTPRep.frm.
The code in said button follows:
Dim xlShell
Dim xlApp As Object
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
On Error Resume Next
Err.Clear
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
rsGroup.MoveFirst
For i = 0 To rsGroup.RecordCount - 1
xlSheet.Cells(i + 1, 1) = rsGroup!Group
'xlSheet.Cells.Value = rsGroup!Group
rsGroup.MoveNext
Next i
xlSheet.SaveAs "c:\test.xls"
xlBook.Close
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
xlShell = Shell(strExcelLocation + " c:\test.xls", vbNormalFocus)
If Err.Number <> 0 Then
MsgBox "Error " & FormatNumber(Err.Number, 0) & ": " & Err.Description
xlShell = 0
End If
----End of Code---
Again, let me state that this is fully functional on my pc with no problems whatever. Hmm. What could be wrong?
>Copy the content of your .VBP file here.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement