Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
EXCEL.exe has created errors and will be closed by Windows.
I have a macro that runs from an add-in. In this macro is code t
insertlines in to a Sub Procedure on a different workbook. This is th code I have so far, but I get the error below when the code reaches th line: LineNum = CountOfLines + 1 EXCEL.exe has created errors and will be closed by Windows. Any help would be greatly appriciated. Dim cmbBtn As OLEObject Dim strCmdName As String Dim ModEvent As CodeModule 'Module to Modified Dim LineNum As Long 'Line number in module Dim SubName As String 'Button Code name Dim strProc As String 'Procedure string Dim EndS As String 'End sub string Dim sTab As String 'Tab Dim LF As String 'Line feed or carriage return Ap = Chr(34) sTab = Chr(9) LF = Chr(13) EndS = "End Sub" Set cmbBtn = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Combo Box.1" Link:=False, DisplayAsIcon:=False, Left:=395.25, Top:=11.8, Width:=96 Height:=27) SubName = "Private Sub " & cmbBtn.Name & "_Change()" & LF strProc = "if" & ActiveSheet.Range("e2").Value = "William Day" & "Then & ActiveSheet.Range("f2").Value = "DAYWI" & "end if" Set ModEvent ActiveWorkbook.VBProject.VBComponents(ActiveSheet. CodeName).CodeModule With ModEvent LineNum = CountOfLines + 1 .InsertLines LineNum, SubName & strProc & EndS End Wit -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel.exe has generated errors and will be shutdown by windows | Excel Discussion (Misc queries) | |||
can not print excel document on mac that was created in windows | Excel Discussion (Misc queries) | |||
Display Charts Created In Excel In A Windows Form | Charts and Charting in Excel | |||
lines in worksheet opened in Windows but created in Excel for Mac | Excel Discussion (Misc queries) | |||
Errors Opening Excel 2000 files in Windows 98 previously saved in | Excel Discussion (Misc queries) |