close

I downlaoded a VBA script from XL-Logic.com called default_wb.zip. I wanted
to try this to see if it would work for my application. It was a sample on
how to automate the creation of workbooks and sheets. It was not what I
thought. Now every time I open a new workbook or sheet in Excel, this macro
starts and will not give me a blank sheet or workbook. I have copied the
scrip below to see if anyone can figure out how I get rid of this. Please
help, it is driving me crazy. Hee is the text that shows up on the workbook
when I start it, it is on sheet1, it says
quot;This workbook contains example macros that show how default sheets and
workbooks can be quickly created using VBA. The code allows you to set up
this workbook as you would like all new workbooks (worksheets) to appear.
When you run the macros, the appropriate default workbook/worksheet is saved
in the XLstart directory.quot;.
I went to the XL start directory but there is nothing there. Please help.
Here are the two macros:

Sub WorkbookDefault()
Dim ans As Integer
ans = MsgBox(prompt:=quot;New workbooks will be base on this workbook with
the same page setup, view options... Even the content will be the same.quot; amp;
Chr(13) amp; Chr(13) amp; _
quot;This procedure can not be undone. Do you want to proceed?quot; amp;
Chr(13), Buttons:=vbYesNo)
If ans = vbNo Then End
Application.DisplayAlerts = False
If Application.AltStartupPath lt;gt; quot;quot; And Dir(Application.AltStartupPath,
16) lt;gt; quot;quot; Then
ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
quot;\book.xltquot;, FileFormat:=xlTemplate
ActiveWindow.Close
End
End If
On Error GoTo 10
ActiveWorkbook.SaveAs Filename:=Application.StartupPath amp; quot;\book.xltquot;,
FileFormat:=xlTemplate
ActiveWindow.Close
End
10: If Application.DefaultFilePath lt;gt; quot;quot; And
Dir(Application.DefaultFilePath, 16) lt;gt; quot;quot; Then
MkDir Application.DefaultFilePath amp; quot;\xlstartquot;
Application.AltStartupPath = Application.DefaultFilePath amp; quot;\xlstartquot;
ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
quot;\book.xltquot;, FileFormat:=xlTemplate
Else
MkDir quot;c:\xlstartquot;
Application.AltStartupPath = quot;c:\xlstartquot;
ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
quot;\book.xltquot;, FileFormat:=xlTemplate
End If
ActiveWindow.Close
End Sub

Sub SheetDefault()
Dim Sh
Dim ans As Integer
ans = MsgBox(prompt:=quot;New sheets will be base on this sheet with the
same page setup, view options... Even the content will be the same.quot; amp;
Chr(13) amp; Chr(13) amp; _
quot;This procedure can not be undone. Do you want to proceed?quot; amp;
Chr(13), Buttons:=vbYesNo)
If ans = vbNo Then End
Application.DisplayAlerts = False
ActiveSheet.Copy
For Each Sh In ActiveWorkbook.Sheets
If Sh.Name lt;gt; ActiveSheet.Name Then Sh.Delete
Next Sh
ActiveSheet.Name = quot; quot;
If Application.AltStartupPath lt;gt; quot;quot; And Dir(Application.AltStartupPath,
16) lt;gt; quot;quot; Then
ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
quot;\sheet.xltquot;, FileFormat:=xlTemplate
ActiveWindow.Close
End
End If
On Error GoTo 10
ActiveSheet.SaveAs Filename:=Application.StartupPath amp; quot;\sheet.xltquot;,
FileFormat:=xlTemplate
ActiveWindow.Close
End
10: If Application.DefaultFilePath lt;gt; quot;quot; And
Dir(Application.DefaultFilePath, 16) lt;gt; quot;quot; Then
MkDir Application.DefaultFilePath amp; quot;\xlstartquot;
Application.AltStartupPath = Application.DefaultFilePath amp; quot;\xlstartquot;
ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
quot;\sheet.xltquot;, FileFormat:=xlTemplate
Else
MkDir quot;c:\xlstartquot;
Application.AltStartupPath = quot;c:\xlstartquot;
ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
quot;\sheet.xltquot;, FileFormat:=xlTemplate
End If
ActiveWindow.Close
End SubThanks for any inputtry
toolsgt;optionsgt;generalgt;quot;at startupquot;

--
Don Guillett
SalesAid Software

quot;JackRquot; gt; wrote in message
...
gt;I downlaoded a VBA script from XL-Logic.com called default_wb.zip. I wanted
gt; to try this to see if it would work for my application. It was a sample on
gt; how to automate the creation of workbooks and sheets. It was not what I
gt; thought. Now every time I open a new workbook or sheet in Excel, this
gt; macro
gt; starts and will not give me a blank sheet or workbook. I have copied the
gt; scrip below to see if anyone can figure out how I get rid of this. Please
gt; help, it is driving me crazy. Hee is the text that shows up on the
gt; workbook
gt; when I start it, it is on sheet1, it says
gt; quot;This workbook contains example macros that show how default sheets and
gt; workbooks can be quickly created using VBA. The code allows you to set up
gt; this workbook as you would like all new workbooks (worksheets) to appear.
gt; When you run the macros, the appropriate default workbook/worksheet is
gt; saved
gt; in the XLstart directory.quot;.
gt; I went to the XL start directory but there is nothing there. Please help.
gt; Here are the two macros:
gt;
gt; Sub WorkbookDefault()
gt; Dim ans As Integer
gt; ans = MsgBox(prompt:=quot;New workbooks will be base on this workbook with
gt; the same page setup, view options... Even the content will be the same.quot; amp;
gt; Chr(13) amp; Chr(13) amp; _
gt; quot;This procedure can not be undone. Do you want to proceed?quot; amp;
gt; Chr(13), Buttons:=vbYesNo)
gt; If ans = vbNo Then End
gt; Application.DisplayAlerts = False
gt; If Application.AltStartupPath lt;gt; quot;quot; And Dir(Application.AltStartupPath,
gt; 16) lt;gt; quot;quot; Then
gt; ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
gt; quot;\book.xltquot;, FileFormat:=xlTemplate
gt; ActiveWindow.Close
gt; End
gt; End If
gt; On Error GoTo 10
gt; ActiveWorkbook.SaveAs Filename:=Application.StartupPath amp; quot;\book.xltquot;,
gt; FileFormat:=xlTemplate
gt; ActiveWindow.Close
gt; End
gt; 10: If Application.DefaultFilePath lt;gt; quot;quot; And
gt; Dir(Application.DefaultFilePath, 16) lt;gt; quot;quot; Then
gt; MkDir Application.DefaultFilePath amp; quot;\xlstartquot;
gt; Application.AltStartupPath = Application.DefaultFilePath amp;
gt; quot;\xlstartquot;
gt; ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
gt; quot;\book.xltquot;, FileFormat:=xlTemplate
gt; Else
gt; MkDir quot;c:\xlstartquot;
gt; Application.AltStartupPath = quot;c:\xlstartquot;
gt; ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
gt; quot;\book.xltquot;, FileFormat:=xlTemplate
gt; End If
gt; ActiveWindow.Close
gt; End Sub
gt;
gt; Sub SheetDefault()
gt; Dim Sh
gt; Dim ans As Integer
gt; ans = MsgBox(prompt:=quot;New sheets will be base on this sheet with the
gt; same page setup, view options... Even the content will be the same.quot; amp;
gt; Chr(13) amp; Chr(13) amp; _
gt; quot;This procedure can not be undone. Do you want to proceed?quot; amp;
gt; Chr(13), Buttons:=vbYesNo)
gt; If ans = vbNo Then End
gt; Application.DisplayAlerts = False
gt; ActiveSheet.Copy
gt; For Each Sh In ActiveWorkbook.Sheets
gt; If Sh.Name lt;gt; ActiveSheet.Name Then Sh.Delete
gt; Next Sh
gt; ActiveSheet.Name = quot; quot;
gt; If Application.AltStartupPath lt;gt; quot;quot; And Dir(Application.AltStartupPath,
gt; 16) lt;gt; quot;quot; Then
gt; ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
gt; quot;\sheet.xltquot;, FileFormat:=xlTemplate
gt; ActiveWindow.Close
gt; End
gt; End If
gt; On Error GoTo 10
gt; ActiveSheet.SaveAs Filename:=Application.StartupPath amp; quot;\sheet.xltquot;,
gt; FileFormat:=xlTemplate
gt; ActiveWindow.Close
gt; End
gt; 10: If Application.DefaultFilePath lt;gt; quot;quot; And
gt; Dir(Application.DefaultFilePath, 16) lt;gt; quot;quot; Then
gt; MkDir Application.DefaultFilePath amp; quot;\xlstartquot;
gt; Application.AltStartupPath = Application.DefaultFilePath amp;
gt; quot;\xlstartquot;
gt; ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
gt; quot;\sheet.xltquot;, FileFormat:=xlTemplate
gt; Else
gt; MkDir quot;c:\xlstartquot;
gt; Application.AltStartupPath = quot;c:\xlstartquot;
gt; ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
gt; quot;\sheet.xltquot;, FileFormat:=xlTemplate
gt; End If
gt; ActiveWindow.Close
gt; End Sub
gt;
gt;
gt; Thanks for any input
gt;
I tried that it is blank. Any other ideas

quot;Don Guillettquot; wrote:

gt; try
gt; toolsgt;optionsgt;generalgt;quot;at startupquot;
gt;
gt; --
gt; Don Guillett
gt; SalesAid Software
gt;
gt; quot;JackRquot; gt; wrote in message
gt; ...
gt; gt;I downlaoded a VBA script from XL-Logic.com called default_wb.zip. I wanted
gt; gt; to try this to see if it would work for my application. It was a sample on
gt; gt; how to automate the creation of workbooks and sheets. It was not what I
gt; gt; thought. Now every time I open a new workbook or sheet in Excel, this
gt; gt; macro
gt; gt; starts and will not give me a blank sheet or workbook. I have copied the
gt; gt; scrip below to see if anyone can figure out how I get rid of this. Please
gt; gt; help, it is driving me crazy. Hee is the text that shows up on the
gt; gt; workbook
gt; gt; when I start it, it is on sheet1, it says
gt; gt; quot;This workbook contains example macros that show how default sheets and
gt; gt; workbooks can be quickly created using VBA. The code allows you to set up
gt; gt; this workbook as you would like all new workbooks (worksheets) to appear.
gt; gt; When you run the macros, the appropriate default workbook/worksheet is
gt; gt; saved
gt; gt; in the XLstart directory.quot;.
gt; gt; I went to the XL start directory but there is nothing there. Please help.
gt; gt; Here are the two macros:
gt; gt;
gt; gt; Sub WorkbookDefault()
gt; gt; Dim ans As Integer
gt; gt; ans = MsgBox(prompt:=quot;New workbooks will be base on this workbook with
gt; gt; the same page setup, view options... Even the content will be the same.quot; amp;
gt; gt; Chr(13) amp; Chr(13) amp; _
gt; gt; quot;This procedure can not be undone. Do you want to proceed?quot; amp;
gt; gt; Chr(13), Buttons:=vbYesNo)
gt; gt; If ans = vbNo Then End
gt; gt; Application.DisplayAlerts = False
gt; gt; If Application.AltStartupPath lt;gt; quot;quot; And Dir(Application.AltStartupPath,
gt; gt; 16) lt;gt; quot;quot; Then
gt; gt; ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
gt; gt; quot;\book.xltquot;, FileFormat:=xlTemplate
gt; gt; ActiveWindow.Close
gt; gt; End
gt; gt; End If
gt; gt; On Error GoTo 10
gt; gt; ActiveWorkbook.SaveAs Filename:=Application.StartupPath amp; quot;\book.xltquot;,
gt; gt; FileFormat:=xlTemplate
gt; gt; ActiveWindow.Close
gt; gt; End
gt; gt; 10: If Application.DefaultFilePath lt;gt; quot;quot; And
gt; gt; Dir(Application.DefaultFilePath, 16) lt;gt; quot;quot; Then
gt; gt; MkDir Application.DefaultFilePath amp; quot;\xlstartquot;
gt; gt; Application.AltStartupPath = Application.DefaultFilePath amp;
gt; gt; quot;\xlstartquot;
gt; gt; ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
gt; gt; quot;\book.xltquot;, FileFormat:=xlTemplate
gt; gt; Else
gt; gt; MkDir quot;c:\xlstartquot;
gt; gt; Application.AltStartupPath = quot;c:\xlstartquot;
gt; gt; ActiveWorkbook.SaveAs Filename:=Application.AltStartupPath amp;
gt; gt; quot;\book.xltquot;, FileFormat:=xlTemplate
gt; gt; End If
gt; gt; ActiveWindow.Close
gt; gt; End Sub
gt; gt;
gt; gt; Sub SheetDefault()
gt; gt; Dim Sh
gt; gt; Dim ans As Integer
gt; gt; ans = MsgBox(prompt:=quot;New sheets will be base on this sheet with the
gt; gt; same page setup, view options... Even the content will be the same.quot; amp;
gt; gt; Chr(13) amp; Chr(13) amp; _
gt; gt; quot;This procedure can not be undone. Do you want to proceed?quot; amp;
gt; gt; Chr(13), Buttons:=vbYesNo)
gt; gt; If ans = vbNo Then End
gt; gt; Application.DisplayAlerts = False
gt; gt; ActiveSheet.Copy
gt; gt; For Each Sh In ActiveWorkbook.Sheets
gt; gt; If Sh.Name lt;gt; ActiveSheet.Name Then Sh.Delete
gt; gt; Next Sh
gt; gt; ActiveSheet.Name = quot; quot;
gt; gt; If Application.AltStartupPath lt;gt; quot;quot; And Dir(Application.AltStartupPath,
gt; gt; 16) lt;gt; quot;quot; Then
gt; gt; ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
gt; gt; quot;\sheet.xltquot;, FileFormat:=xlTemplate
gt; gt; ActiveWindow.Close
gt; gt; End
gt; gt; End If
gt; gt; On Error GoTo 10
gt; gt; ActiveSheet.SaveAs Filename:=Application.StartupPath amp; quot;\sheet.xltquot;,
gt; gt; FileFormat:=xlTemplate
gt; gt; ActiveWindow.Close
gt; gt; End
gt; gt; 10: If Application.DefaultFilePath lt;gt; quot;quot; And
gt; gt; Dir(Application.DefaultFilePath, 16) lt;gt; quot;quot; Then
gt; gt; MkDir Application.DefaultFilePath amp; quot;\xlstartquot;
gt; gt; Application.AltStartupPath = Application.DefaultFilePath amp;
gt; gt; quot;\xlstartquot;
gt; gt; ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
gt; gt; quot;\sheet.xltquot;, FileFormat:=xlTemplate
gt; gt; Else
gt; gt; MkDir quot;c:\xlstartquot;
gt; gt; Application.AltStartupPath = quot;c:\xlstartquot;
gt; gt; ActiveSheet.SaveAs Filename:=Application.AltStartupPath amp;
gt; gt; quot;\sheet.xltquot;, FileFormat:=xlTemplate
gt; gt; End If
gt; gt; ActiveWindow.Close
gt; gt; End Sub
gt; gt;
gt; gt;
gt; gt; Thanks for any input
gt; gt;
gt;
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()