SaveAs Question

G

Greg Little

I'm using
Activeworkbook.SaveAs.("C:Copyofthecurrent") to save a copy
on my desktop. If this runs on Win 98, works just fine. What happens
if it runs on Win 2k or XP, which have multiple users? Is the user an
issue or will it just save to the desktop, which is the desired
result? Also, what happens in the rare case that the user doesn't have
a C drive? I'd expect a macro error- How do I get around these
problems, if problems they are? TIA
Greg
 
J

Jim Cone

Greg,

I can't get your code snippet to compile.
However, the following code will place a shortcut to the active workbook on the desktop.
Maybe it will suit your needs...
'-----------------------------------------
Sub DesktopShortcut()
Dim WSHShell As Object
Dim MyShortcut As Object
Dim DesktopPath As String

Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\" & ActiveWorkbook.Name & ".lnk")

With MyShortcut
.TargetPath = ActiveWorkbook.FullName
' .IconLocation = "F:\Icons\Arrows\ARW03LT.ICO" 'your choice
.WindowStyle = 1 'not sure if needed
.Save
End With

Set WSHShell = Nothing
Set MyShortcut = Nothing
MsgBox "A shortcut has been placed on your desktop. ", vbInformation, " Primitive Software"
End Sub
'----------------------------------

Jim Cone
San Francisco, CA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top