View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default create a file, put a excel sheet in and a icon

Dim bErr as Boolean
on error resume next
Mkdir "C:\MyFolder"
bErr = (err.Number < 0)
On Error goto 0
if bErr then
if dir("C:\Myfolder\inventry.xls") < "" then
Download
else
ThisWorkbook.SaveAs "C:\MyFolder\inventry.xls"
CreateShortCut thisworkbook
end if
Else
ThisWorkbook.SaveAs "C:\MyFolder\inventry.xls"
CreateShortCut thisworkbook
End if


End Sub



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


--
Regards,
Tom Ogilvy



"pswanie" wrote:

are there a macro i can put in place to

check if c:\myfolder\inventry.xls exist. if it does run macro called download

if not create c:\myfolder. save as this workbook (the one thats open and
contain this macro) and create a short cut macro on desktop