Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes
Hi,
I am using Excel 2007 on Windows XP. On the sheet I have a button (form button) that executes the macro below. The macro runs fine, the new workbook (myTemplate1.xls) opens up OK. The problem occurs when I close the workbook (myTemplate1.xls) Excel crashes. What am I doing wrong? By the way I have been using myTemplate (opening it manually) for years without a problem. It is only when I open it using the macro below that I have this problem. Thanks for any help Fred Sub Button432_Click() Dim PartNo As String PartNo = Trim(Sheet1.Range("C8").Value) If PartNo < "" Then Workbooks.Add Template:="\\myServer\myDrive\myTemplate.xlt" End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes
Hi Fred
This is working for me for a file in the template folder Sub Insert_Template() Dim wb As Workbook Dim wbName As String 'name of the template wbName = "MyTemplate.xltm" 'Insert sheet template With ThisWorkbook Set wb = Workbooks.Add(Template:=Application.TemplatesPath & wbName) End With End Sub See this page for sheet templates http://www.rondebruin.nl/sheettemplate.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi, I am using Excel 2007 on Windows XP. On the sheet I have a button (form button) that executes the macro below. The macro runs fine, the new workbook (myTemplate1.xls) opens up OK. The problem occurs when I close the workbook (myTemplate1.xls) Excel crashes. What am I doing wrong? By the way I have been using myTemplate (opening it manually) for years without a problem. It is only when I open it using the macro below that I have this problem. Thanks for any help Fred Sub Button432_Click() Dim PartNo As String PartNo = Trim(Sheet1.Range("C8").Value) If PartNo < "" Then Workbooks.Add Template:="\\myServer\myDrive\myTemplate.xlt" End If End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes
You can remove a few lines (I changed the sheet example from my site)
Sub Insert_Template() Dim wb As Workbook Dim wbName As String 'name of the template wbName = "MyTemplate.xltm" Set wb = Workbooks.Add(Template:=Application.TemplatesPath & wbName) End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Hi Fred This is working for me for a file in the template folder Sub Insert_Template() Dim wb As Workbook Dim wbName As String 'name of the template wbName = "MyTemplate.xltm" 'Insert sheet template With ThisWorkbook Set wb = Workbooks.Add(Template:=Application.TemplatesPath & wbName) End With End Sub See this page for sheet templates http://www.rondebruin.nl/sheettemplate.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi, I am using Excel 2007 on Windows XP. On the sheet I have a button (form button) that executes the macro below. The macro runs fine, the new workbook (myTemplate1.xls) opens up OK. The problem occurs when I close the workbook (myTemplate1.xls) Excel crashes. What am I doing wrong? By the way I have been using myTemplate (opening it manually) for years without a problem. It is only when I open it using the macro below that I have this problem. Thanks for any help Fred Sub Button432_Click() Dim PartNo As String PartNo = Trim(Sheet1.Range("C8").Value) If PartNo < "" Then Workbooks.Add Template:="\\myServer\myDrive\myTemplate.xlt" End If End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes
Thanks Ron,
I have been playing around a bit more and it doesn't seem to be related to the macro at all. Even if I open each of these workbooks manually then close one it crashes Excel yet each workbook works fine by itself and they both work fine with other workbooks. I know it sounds strange. I find it hard to believe but I have tried all sorts of combinations of various workbooks and it only happens when both of these workbooks are open and it happens every time. Other than the macro for the button, there is no other link between the workbooks. It even happens when one of the workbooks is opened in a different instance of Excel although this does seem to intermitant. I'd appreciate any idea on what could cause this. Thanks Fred "Ron de Bruin" wrote in message ... Hi Fred This is working for me for a file in the template folder Sub Insert_Template() Dim wb As Workbook Dim wbName As String 'name of the template wbName = "MyTemplate.xltm" 'Insert sheet template With ThisWorkbook Set wb = Workbooks.Add(Template:=Application.TemplatesPath & wbName) End With End Sub See this page for sheet templates http://www.rondebruin.nl/sheettemplate.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi, I am using Excel 2007 on Windows XP. On the sheet I have a button (form button) that executes the macro below. The macro runs fine, the new workbook (myTemplate1.xls) opens up OK. The problem occurs when I close the workbook (myTemplate1.xls) Excel crashes. What am I doing wrong? By the way I have been using myTemplate (opening it manually) for years without a problem. It is only when I open it using the macro below that I have this problem. Thanks for any help Fred Sub Button432_Click() Dim PartNo As String PartNo = Trim(Sheet1.Range("C8").Value) If PartNo < "" Then Workbooks.Add Template:="\\myServer\myDrive\myTemplate.xlt" End If End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes
Hi Fred
Is there code in the template -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Thanks Ron, I have been playing around a bit more and it doesn't seem to be related to the macro at all. Even if I open each of these workbooks manually then close one it crashes Excel yet each workbook works fine by itself and they both work fine with other workbooks. I know it sounds strange. I find it hard to believe but I have tried all sorts of combinations of various workbooks and it only happens when both of these workbooks are open and it happens every time. Other than the macro for the button, there is no other link between the workbooks. It even happens when one of the workbooks is opened in a different instance of Excel although this does seem to intermitant. I'd appreciate any idea on what could cause this. Thanks Fred "Ron de Bruin" wrote in message ... Hi Fred This is working for me for a file in the template folder Sub Insert_Template() Dim wb As Workbook Dim wbName As String 'name of the template wbName = "MyTemplate.xltm" 'Insert sheet template With ThisWorkbook Set wb = Workbooks.Add(Template:=Application.TemplatesPath & wbName) End With End Sub See this page for sheet templates http://www.rondebruin.nl/sheettemplate.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi, I am using Excel 2007 on Windows XP. On the sheet I have a button (form button) that executes the macro below. The macro runs fine, the new workbook (myTemplate1.xls) opens up OK. The problem occurs when I close the workbook (myTemplate1.xls) Excel crashes. What am I doing wrong? By the way I have been using myTemplate (opening it manually) for years without a problem. It is only when I open it using the macro below that I have this problem. Thanks for any help Fred Sub Button432_Click() Dim PartNo As String PartNo = Trim(Sheet1.Range("C8").Value) If PartNo < "" Then Workbooks.Add Template:="\\myServer\myDrive\myTemplate.xlt" End If End Sub |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes
Hi Ron,
Yes there is code in the template but the code is only macros associated with buttons. I don't click any of the buttons so none of the code is actually run. Both workbooks do have data connections using the same DSN but I have tried both workbooks with other workbooks with similar connections and there is no problem with other combinations of workbooks. Fred "Ron de Bruin" wrote in message ... Hi Fred Is there code in the template -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Thanks Ron, I have been playing around a bit more and it doesn't seem to be related to the macro at all. Even if I open each of these workbooks manually then close one it crashes Excel yet each workbook works fine by itself and they both work fine with other workbooks. I know it sounds strange. I find it hard to believe but I have tried all sorts of combinations of various workbooks and it only happens when both of these workbooks are open and it happens every time. Other than the macro for the button, there is no other link between the workbooks. It even happens when one of the workbooks is opened in a different instance of Excel although this does seem to intermitant. I'd appreciate any idea on what could cause this. Thanks Fred "Ron de Bruin" wrote in message ... Hi Fred This is working for me for a file in the template folder Sub Insert_Template() Dim wb As Workbook Dim wbName As String 'name of the template wbName = "MyTemplate.xltm" 'Insert sheet template With ThisWorkbook Set wb = Workbooks.Add(Template:=Application.TemplatesPath & wbName) End With End Sub See this page for sheet templates http://www.rondebruin.nl/sheettemplate.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi, I am using Excel 2007 on Windows XP. On the sheet I have a button (form button) that executes the macro below. The macro runs fine, the new workbook (myTemplate1.xls) opens up OK. The problem occurs when I close the workbook (myTemplate1.xls) Excel crashes. What am I doing wrong? By the way I have been using myTemplate (opening it manually) for years without a problem. It is only when I open it using the macro below that I have this problem. Thanks for any help Fred Sub Button432_Click() Dim PartNo As String PartNo = Trim(Sheet1.Range("C8").Value) If PartNo < "" Then Workbooks.Add Template:="\\myServer\myDrive\myTemplate.xlt" End If End Sub |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes
Hi Fred
Try to rebuild the template file maybe it is corrupt -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi Ron, Yes there is code in the template but the code is only macros associated with buttons. I don't click any of the buttons so none of the code is actually run. Both workbooks do have data connections using the same DSN but I have tried both workbooks with other workbooks with similar connections and there is no problem with other combinations of workbooks. Fred "Ron de Bruin" wrote in message ... Hi Fred Is there code in the template -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Thanks Ron, I have been playing around a bit more and it doesn't seem to be related to the macro at all. Even if I open each of these workbooks manually then close one it crashes Excel yet each workbook works fine by itself and they both work fine with other workbooks. I know it sounds strange. I find it hard to believe but I have tried all sorts of combinations of various workbooks and it only happens when both of these workbooks are open and it happens every time. Other than the macro for the button, there is no other link between the workbooks. It even happens when one of the workbooks is opened in a different instance of Excel although this does seem to intermitant. I'd appreciate any idea on what could cause this. Thanks Fred "Ron de Bruin" wrote in message ... Hi Fred This is working for me for a file in the template folder Sub Insert_Template() Dim wb As Workbook Dim wbName As String 'name of the template wbName = "MyTemplate.xltm" 'Insert sheet template With ThisWorkbook Set wb = Workbooks.Add(Template:=Application.TemplatesPath & wbName) End With End Sub See this page for sheet templates http://www.rondebruin.nl/sheettemplate.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi, I am using Excel 2007 on Windows XP. On the sheet I have a button (form button) that executes the macro below. The macro runs fine, the new workbook (myTemplate1.xls) opens up OK. The problem occurs when I close the workbook (myTemplate1.xls) Excel crashes. What am I doing wrong? By the way I have been using myTemplate (opening it manually) for years without a problem. It is only when I open it using the macro below that I have this problem. Thanks for any help Fred Sub Button432_Click() Dim PartNo As String PartNo = Trim(Sheet1.Range("C8").Value) If PartNo < "" Then Workbooks.Add Template:="\\myServer\myDrive\myTemplate.xlt" End If End Sub |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes
Thanks Ron,
Re-compiling the workbook didn't help but I removed all of the modules then copied the programs back to new modules and that did fix the problem. Regards, Fred "Ron de Bruin" wrote in message ... Hi Fred Try to rebuild the template file maybe it is corrupt -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi Ron, Yes there is code in the template but the code is only macros associated with buttons. I don't click any of the buttons so none of the code is actually run. Both workbooks do have data connections using the same DSN but I have tried both workbooks with other workbooks with similar connections and there is no problem with other combinations of workbooks. Fred "Ron de Bruin" wrote in message ... Hi Fred Is there code in the template -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Thanks Ron, I have been playing around a bit more and it doesn't seem to be related to the macro at all. Even if I open each of these workbooks manually then close one it crashes Excel yet each workbook works fine by itself and they both work fine with other workbooks. I know it sounds strange. I find it hard to believe but I have tried all sorts of combinations of various workbooks and it only happens when both of these workbooks are open and it happens every time. Other than the macro for the button, there is no other link between the workbooks. It even happens when one of the workbooks is opened in a different instance of Excel although this does seem to intermitant. I'd appreciate any idea on what could cause this. Thanks Fred "Ron de Bruin" wrote in message ... Hi Fred This is working for me for a file in the template folder Sub Insert_Template() Dim wb As Workbook Dim wbName As String 'name of the template wbName = "MyTemplate.xltm" 'Insert sheet template With ThisWorkbook Set wb = Workbooks.Add(Template:=Application.TemplatesPath & wbName) End With End Sub See this page for sheet templates http://www.rondebruin.nl/sheettemplate.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Fred" <leavemealone@home wrote in message ... Hi, I am using Excel 2007 on Windows XP. On the sheet I have a button (form button) that executes the macro below. The macro runs fine, the new workbook (myTemplate1.xls) opens up OK. The problem occurs when I close the workbook (myTemplate1.xls) Excel crashes. What am I doing wrong? By the way I have been using myTemplate (opening it manually) for years without a problem. It is only when I open it using the macro below that I have this problem. Thanks for any help Fred Sub Button432_Click() Dim PartNo As String PartNo = Trim(Sheet1.Range("C8").Value) If PartNo < "" Then Workbooks.Add Template:="\\myServer\myDrive\myTemplate.xlt" End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
F11 Crashes Excel | Excel Programming | |||
excel crashes | Excel Discussion (Misc queries) | |||
Excel XP Crashes | Excel Discussion (Misc queries) | |||
Excel Crashes | Excel Worksheet Functions | |||
Excel 97 crashes | Excel Programming |