Personal vba - interaction xls/xlt

  • Thread starter Thread starter Zurn
  • Start date Start date
Z

Zurn

Following code does not work when I put it in my PERSONAL folder in VBA

It works when I see both source and destination xls/xlt in the VB
explorer.


What should I change about the code to make it work?

'=============================================
Sub ExportSORTSTARS()
Dim originWorkbook As Workbook
Set originWorkbook = ActiveWorkbook
Dim newSheet As Worksheet
sheetS("SS").Activate
Cells(1, 1).Activate
Cells.Select
Selection.Copy
Windows("SS0.xlt").Activate
Set newSheet = Worksheets.Add
newSheet.Name = "SS"
Cells(1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
Operation:=xlNone
newSheet.Visible = False
Application.CutCopyMode = False
originWorkbook.Activate
End Su
 
Anyone an idea?

It works when opening the template first, and opening it's VB
environment. Then opening the xls workbook and it's VBA environment
Only then I get access to the code of both xls and xlt through the sam
window. And only then it works.

In other cases, the object SS.xlt is not found.


Any help on this topic?


Thank yo
 
Back
Top