Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
create a file, put a excel sheet in and a icon
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
create a file, put a excel sheet in and a icon
thanx man... appreciate!!
take care "Tom Ogilvy" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
why does excel create a new desktop icon when file is saved? | Setting up and Configuration of Excel | |||
I can not open excel sheet by pressing file icon | Excel Discussion (Misc queries) | |||
How to create icon sets for excel 2007 conditionnal formating ? | Excel Discussion (Misc queries) | |||
[Macro excel] How to create and export a sheet into a *.inp (or *.txt) file | Excel Programming | |||
In Excel, how do I create a point and click icon? | Excel Programming |