Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Crashes when Saving to .xls Diana Excel Discussion (Misc queries) 1 May 5th 10 08:53 PM
Excel 2007 Crashes D@SE Excel Discussion (Misc queries) 2 June 16th 09 04:56 PM
Excel 2007 Crashes rykkim Excel Discussion (Misc queries) 0 February 19th 09 09:33 PM
Excel 2007 crashes when converting to XLS SunsetKid Excel Discussion (Misc queries) 0 December 18th 08 02:42 AM
Excel 2007 Crashes Big Al Excel Discussion (Misc queries) 4 August 4th 06 08:11 AM


All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"