Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro in template opens last saved document
I created a custom toolbar with two buttons. One button adds a blank ro
to the spreadsheet with proper formatting and the other removes a row. I assigned a macro to each button. The problem is when I open th template to create a new spreadsheet and click either of the buttons i tries to open the last saved document created by this template to ru the macro from. The custom toolbar is attached to the template. When assign the macro to the button it is referenced as AddNewRow. After create one document from the template and save then create a ne template, that new template custom toolbar button is referencin 'C:\Documents and Settings\.....\test.xls'!addnewrow. Any thoughts? Code: Sub AddNewRow() ' 'Dim Row_Count As Integer Dim pswrd Dim QtyCell As String Dim msg Dim myRow As String myRow = ActiveCell.Row Range("B" & myRow).Select If Not Selection.Interior.ColorIndex = xlNone Then msg = "You've chosen to add a row in a locked area. " & Chr(13 & _ "Please select a different area to insert a row then tr again." response = MsgBox(msg, vbCritical) GoTo 100 End If pswrd = "" ActiveSheet.Unprotect pswrd 'Row_Count = InputBox("Enter number of rows required.") 'Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Row_Count - 1 0)).EntireRow.Insert Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(0 0)).EntireRow.Insert 'myRow = ActiveCell.Row 'Range("B" & myRow).Select Range(Selection, Selection.Offset(0, 4)).Select Selection.Interior.ColorIndex = xlNone Selection.RowHeight = 12.75 Selection.Locked = False Selection.FormulaHidden = False Selection.Borders(xlDiagonalDown).LineStyle = xlNone 'next many line are for border formatting Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Font .Name = "Arial" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Selection.Font.Bold = False ActiveCell.Select QtyCell = ActiveCell.Address With Selection .NumberFormat = "General" .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = False .Orientation = 0 .AddIndent = False '.IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With ActiveCell.Offset(0, 2).HorizontalAlignment = xlLeft 'des alignment ActiveCell.Offset(0, 2).WrapText = True 'desc wra text ActiveCell.Offset(0, 3).NumberFormat = "$#,##0.00" 'ListCell = ActiveCell.Offset(0, 3).Address ActiveCell.Offset(0, 4).NumberFormat = "$#,##0.00" ActiveCell.Offset(0, 4).Formula = "=" & QtyCell & "*" ActiveCell.Offset(0, 3).Address ActiveSheet.Protect pswrd, True, True, True ' 100 End Su -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro in template opens last saved document
|
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro in template opens last saved document
Save the workbook with your functions in it as an add-in (.xla) and the
use ToolsAdd-ins to add the functions permanently.. -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Document Not Saved" Saving File Created from Template PLEASEHELP!!!! | Excel Discussion (Misc queries) | |||
Creating a macro to print the date a document was last saved. | Excel Discussion (Misc queries) | |||
Document not saved at the end of macro | Excel Discussion (Misc queries) | |||
saved worksheet opens in new with macro error report | Excel Worksheet Functions | |||
help creating a macro in excel that opens a specific word document | Excel Discussion (Misc queries) |