This is my code:
Sub Aut
pen1()
Dim Path, MalNavn, SkipsValg, NyPath, NyDrive, NyPlass, IconName, Sep,
BookName, ShortCutFolder, _
BookFullName, DesktopPath, ShortcutFile, ShortcutMap, VismaNavn,
StandardNavn, NyFolder, Manual, _
Mnd, MndKatalog, Teller, Passord, FolderNavn, FulltNavn, Navn, KatNavn,
HistorieDato, Ny As String
Dim i, x, a, b, S_ID, ST_ID, Ã…r As Integer
Dim fs, oWsh, oShortcutFile, oShortcutMap As Object
Application.DisplayAlerts = False
Application.ScreenUpdating = False
UF_1.Show
Unload UF_1
Unload UF_2
Unload UF_3
Unload UF_4
Application.ScreenUpdating = True
Pause 10
NyDrive = Range("NyDrive")
NyFolder = Range("NyFolder")
Path = Range("Path")
MalNavn = Range("MalNavn")
FolderNavn = Range("FolderNavn")
SkipsValg = Range("SkipsValg")
VismaNavn = Range("VismaNavn")
S_ID = Range("S_ID")
Teller = Range("Teller").Address
Mnd = Range("Mnd")
NyPlass = NyDrive & NyFolder
StandardNavn = Range("StandardNavn")
MndKatalog = Range("MndKatalog")
Passord = Range("Passord")
'Manual = Range("Manual")
'FileCopy Path & Manual, NyDrive & NyFolder & Manual
FileCopy Path & "Arbeidslistelogg.xls", NyDrive & NyFolder &
"Arbeidslistelogg.xls"
Workbooks.Open Filename:=NyDrive & NyFolder & "Arbeidslistelogg.xls"
Sheets("Forside").Select
ActiveSheet.Unprotect Passord
Range("A2").Select
ActiveCell = SkipsValg
ActiveSheet.Protect Passord, DrawingObjects:=False, Contents:=True,
Scenarios:= _
False, AllowFormattingRows:=True
'Oppretter katalog for hver måned og flytter gamle filer til riktig
katalog
Windows("StartInstallasjonVer2.0.xls").Activate
Sheets("Formler").Select
For a = 1 To 12
Windows("StartInstallasjonVer2.0.xls").Activate
Range(Teller).Select
ActiveCell = a
If a < 10 Then
b = "0" & CStr(a)
Else: b = a
End If
If a < 9 Then
Ã…r = 2009
Else: Ã…r = 2008
End If
MndKatalog = Range("MndKatalog")
Mnd = Range("Mnd")
MkDir Mnd
Windows("Arbeidslistelogg.xls").Activate
Sheets(MndKatalog).Select
ActiveSheet.Unprotect Passord
Range("D6").Select
ActiveCell.Value = Ã…r
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Arbeidsliste"
.SearchSubFolders = True
.Filename = "*" & b & Ã…r & ".xls"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
FulltNavn = .FoundFiles(i)
Navn =
CreateObject("Scripting.FileSystemObject").GetFileName(.FoundFiles(i))
KatNavn =
CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(.FoundFiles(i))
Windows("StartInstallasjonVer2.0.xls").Activate
Range("C36").Select
ActiveCell = Navn
Range("C37").Select
ActiveCell = FulltNavn
For x = 0 To 99
Range("D39").Select
ActiveCell = x
Range("E36").Select
If ActiveCell.Text = "ja" Then
Range("D37").Select
HistorieDato = ActiveCell.Value
GoTo Line4
End If
Next x
Line4:
Windows("Arbeidslistelogg.xls").Activate
Sheets(MndKatalog).Select
ActiveSheet.Unprotect Passord
Range("D" & HistorieDato + 9).Select
ActiveCell = Navn
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
Mnd & "\" & Navn, TextToDisplay:=Navn
Range(ActiveCell.Address).Offset(0, 1).Select
ActiveCell = Mnd
Range(ActiveCell.Address).Offset(0, 1).Select
ActiveCell = "'Fil fra tidligere versjon - Ingen informasjon
tilgjenglig. "
ActiveSheet.Protect Passord, DrawingObjects:=False,
Contents:=True, Scenarios:= _
False, AllowFormattingRows:=True
Ny =
CreateObject("Scripting.FileSystemObject").MoveFile(FulltNavn, Mnd & "\")
Next i
Else
End If
End With
Next a
Patrick Molloy skrev: