Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does excel create a new desktop icon when file is saved? PLEES Setting up and Configuration of Excel 0 August 3rd 08 10:24 PM
I can not open excel sheet by pressing file icon sss Excel Discussion (Misc queries) 1 May 13th 08 02:35 PM
How to create icon sets for excel 2007 conditionnal formating ? Julien Montserrat Excel Discussion (Misc queries) 1 January 30th 07 05:50 PM
[Macro excel] How to create and export a sheet into a *.inp (or *.txt) file MrKermit[_3_] Excel Programming 3 April 11th 06 08:30 AM
In Excel, how do I create a point and click icon? Marauder1 Excel Programming 2 February 21st 06 06:04 PM


All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"