Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help DLL calling in Excel 2007 crashes
This is going to sound weird and I have look for some help all over the net
to no avail. I have an add-in which contains numerous VBA functions in it. One of these functions calls a function in a DLL and when that DLL function returns, the VBA continues executing by starting the same VBA function over. First off, this call works perfectly in Excel 2002 & 2003. But in Excel 2007, the DLL call causes the VBA function to restart to the top. Here is the declaration of the DLL call: Private Function EnablePrinter Lib "cdintf.dll" (ByVal hPrinter As Long, ByRef szCompany As String, ByRef szCode As String) As Long The VBA funtion is something like this: Public Function ConvertPlain(ByVal XLSFilename, ByVal PrintToPrinterName As String, ByVal Printer As Long, ByVal LicensedTo As String, ByVal ActivationCode As String) As Integer ConvertPlain = 1 Application.Workbooks.Open XLSFileName, 3, False ActiveWorkbook.RunAutoMacros xlAutoOpen With ActiveWorkBook EnablePrinter(Printer, LicensedTo, ActivationCode) .PrintOut ActivePrinter:=PrintToPrinterName End With End Function So when the EnablePrinter function executes, the next line executing is ConvertPlain = 1. Go figure. Any help welcome Wheeley |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 Crashes when Saving to .xls | Excel Discussion (Misc queries) | |||
Excel 2007 Crashes | Excel Discussion (Misc queries) | |||
Excel 2007 Crashes | Excel Discussion (Misc queries) | |||
Excel 2007 crashes when converting to XLS | Excel Discussion (Misc queries) | |||
Excel 2007 Crashes | Excel Discussion (Misc queries) |