We have business application that exports data to Excel. It does this directly, you push the button in our application and Excel starts and opens with a new sheet that displays all the lists.
Those lists are formatted badly. I have a macro that reformats (Arial 8 etc.) but I need to distribute this macro to a few hundred PCs that also have other makros installed. Thus I can't simply distribute the XLSTART file.
I only want this behaviour.
1. In our application press "Export to Excel"
2. Excel starts and displays the data.
3. A button "appears" in my toolbar (just where the bold etc. is)
4. I push this macro-button and the sheet gets reformatted.
I was thinking about an AddIn. Or how can I achieve my goal?
Code:Sub CQ() Cells.Select With Selection.Font .Name = "Arial" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Selection.Columns.AutoFit With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With End Sub




Reply With Quote