Yes it does. Here are the macro that are attached to the template.
Sub AutoNew()
'
' AutoNew Macro
' Macro created 18/02/2006 by G
'
' If the active document does not contain
' a form field, exit this routine.
If ActiveDocument.FormFields.Count = 0 Then
End
End If
' Create variables.
Dim sAppName As String
Dim sSection As String
Dim sKey As String
Dim sFieldName As String
Dim lRegValue As Long
Dim lFormValue As Long
Dim iDefault As Integer
sAppName = "Word 2003"
sSection = "Reports"
sKey = "Current Report"
' The default starting number.
iDefault = 101
' If the specified form field doesn't exist,
' an error will occur.
On Error GoTo Errhandler
' Replace the following example Form Field bookmark name,
' "Report", with the name of your form field.
Set fField = ActiveDocument.FormFields("Report")
' Get stored registry value, if any.
lRegValue = GetSetting(sAppName, sSection, sKey, iDefault)
' If the result is zero, set to default value.
If lRegValue = 100 Then lRegValue = iDefault
' Set form field result to stored value.
fField.Result = CStr(lRegValue)
' Increment and update Report_Number.
SaveSetting sAppName, sSection, sKey, lRegValue + 1
Errhandler:
If Err <> 0 Then
MsgBox Err.Description
End If
End Sub
Sub Excel_2_Word()
'
' Excel_2_Word Macro
' Macro recorded 6/28/2006 by GPIGHIN
'
Selection.PasteExcelTable False, False, False
End Sub
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 6/28/2006 by GPIGHIN
'
Selection.PasteExcelTable False, False, False
Selection.EscapeKey
End Sub
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 6/28/2006 by GPIGHIN
'
Selection.PasteExcelTable False, False, False
End Sub
Sub Macro3()
'
' Macro3 Macro
' Macro recorded 6/28/2006 by GPIGHIN
'
Selection.PasteSpecial Link:=False, DataType:=wdPasteOLEObject,
Placement _
:=wdInLine, DisplayAsIcon:=False
End Sub
What should I do with this?
> There's nothing in the macro code to close the newly-opened document; so you
> must have some other code running. Does your template have an AutoNew macro?
[quoted text clipped - 82 lines]
> >> > >> >
> >> > >> > Thanks Garry gtpighin@shaw.ca
Jezebel - 06 Aug 2006 07:43 GMT
Well, there's your problem.
> Yes it does. Here are the macro that are attached to the template.
> Sub AutoNew()
[quoted text clipped - 179 lines]
>> >> > >> >
>> >> > >> > Thanks Garry gtpighin@shaw.ca
Garr - 06 Aug 2006 09:44 GMT
Jezebel
I have removed all the macro's in word and only have the one macro in
excel. I have looked for something that might be running in the
background and can't find anything. Have you got any other sujestions
or should I try finding another way to do what I want?
Garry
> Well, there's your problem.
>
[quoted text clipped - 181 lines]
> >> >> > >> >
> >> >> > >> > Thanks Garry gtpighin@shaw.ca
Jezebel - 06 Aug 2006 10:11 GMT
I'd track down the problem, if I were you. Otherwise any other approach will
be suspect also. You shouldn't have any trouble creating a document based on
a template from your Excel macro: if that's not working there are other
things going on (and the appalling AutoNew macro suggests that someone's
being doing some seriously bad coding on your system). Have you checked for
add-ins?
> Jezebel
> I have removed all the macro's in word and only have the one macro in
[quoted text clipped - 200 lines]
>> >> >> > >> >
>> >> >> > >> > Thanks Garry gtpighin@shaw.ca
Garr - 06 Aug 2006 11:28 GMT
Thank you I appreciate all the help.
> I'd track down the problem, if I were you. Otherwise any other approach will
> be suspect also. You shouldn't have any trouble creating a document based on
[quoted text clipped - 207 lines]
> >> >> >> > >> >
> >> >> >> > >> > Thanks Garry gtpighin@shaw.ca