PC Review


Reply
Thread Tools Rate Thread

create a file, put a excel sheet in and a icon

 
 
=?Utf-8?B?cHN3YW5pZQ==?=
Guest
Posts: n/a
 
      19th Jun 2007
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 With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      19th Jun 2007
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 With Quote
 
=?Utf-8?B?cHN3YW5pZQ==?=
Guest
Posts: n/a
 
      19th Jun 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does excel create a new desktop icon when file is saved? PLEES Microsoft Excel Setup 0 3rd Aug 2008 10:24 PM
I can not open excel sheet by pressing file icon sss Microsoft Excel Misc 1 13th May 2008 02:35 PM
How to create a new sheet in EXCEL-File via OLEDBProvider Peter Stojkovic Microsoft VB .NET 1 12th May 2006 01:58 PM
[Macro excel] How to create and export a sheet into a *.inp (or *.txt) file MrKermit Microsoft Excel Programming 3 11th Apr 2006 08:30 AM
How do I create a sheet of Avery file folder labels-sheet size 836 =?Utf-8?B?TWFuaWM2Nw==?= Microsoft Word Document Management 7 19th Mar 2005 08:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:16 PM.