P
pswanie
i got the following code to save a copy of the workbook. I tried to add a
"create shortcut" but it makes the shortcut for the activeworkbook and not
the copy of the workbook...
########################***###########################
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.Protect Password:=""
Dim bErr As Boolean
On Error Resume Next
MkDir "c:\maykent"
MkDir "C:\maykent\stocksheet"
bErr = (Err.Number <> 0)
On Error GoTo 0
If bErr Then
If Dir("C:\maykent\stocksheet\LAST WEEK stocksheet.xls") <> "" Then
ThisWorkbook.SaveCopyAs "C:\maykent\stocksheet\LAST WEEK stocksheet.xls"
CreateShortCut thisworkbook
###########################***########################
&
##########################***#########################
Sub CreateShortCut(bk As Workbook)
Dim oWSH As Object
Dim oShortcut As Object
Dim sPathDeskTop As String
Set oWSH = CreateObject("WScript.Shell")
sPathDeskTop = oWSH.SpecialFolders("Desktop")
Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
bk.Name & ".lnk")
With oShortcut
.TargetPath = bk.FullName
.Save
End With
Set oWSH = Nothing
End Sub
#######################***############################
"create shortcut" but it makes the shortcut for the activeworkbook and not
the copy of the workbook...
########################***###########################
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.Protect Password:=""
Dim bErr As Boolean
On Error Resume Next
MkDir "c:\maykent"
MkDir "C:\maykent\stocksheet"
bErr = (Err.Number <> 0)
On Error GoTo 0
If bErr Then
If Dir("C:\maykent\stocksheet\LAST WEEK stocksheet.xls") <> "" Then
ThisWorkbook.SaveCopyAs "C:\maykent\stocksheet\LAST WEEK stocksheet.xls"
CreateShortCut thisworkbook
###########################***########################
&
##########################***#########################
Sub CreateShortCut(bk As Workbook)
Dim oWSH As Object
Dim oShortcut As Object
Dim sPathDeskTop As String
Set oWSH = CreateObject("WScript.Shell")
sPathDeskTop = oWSH.SpecialFolders("Desktop")
Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
bk.Name & ".lnk")
With oShortcut
.TargetPath = bk.FullName
.Save
End With
Set oWSH = Nothing
End Sub
#######################***############################