Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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
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
F11 Crashes Excel kirkm[_7_] Excel Programming 2 March 14th 08 02:07 AM
excel crashes Matt Excel Discussion (Misc queries) 0 April 20th 07 07:52 PM
Excel XP Crashes Jeff Pines Excel Discussion (Misc queries) 6 February 14th 06 05:50 PM
Excel Crashes SS Excel Worksheet Functions 2 November 8th 05 03:06 PM
Excel 97 crashes Tom Excel Programming 1 June 28th 04 11:04 AM


All times are GMT +1. The time now is 02:50 AM.

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"