ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro using Save As Problem (https://www.excelbanter.com/excel-programming/366557-macro-using-save-problem.html)

mbmadiw

Macro using Save As Problem
 

I recorded a macro that will save the file under another name, then
close it. It works great, but only on my computer.

The problem is that when you're using the file on another computer, the
macro won't work because the user has a different login name. The Save
destination includes my username, which is obviously different on
another computer. Is there a way around this?

Thanks!


--
mbmadiw
------------------------------------------------------------------------
mbmadiw's Profile: http://www.excelforum.com/member.php...o&userid=36153
View this thread: http://www.excelforum.com/showthread...hreadid=559288


Dave Peterson

Macro using Save As Problem
 
I think I would ask the user where they wanted to save the file--using
application.getsaveasfilename.

If you're trying to save to "my documents" or the user's desktop, maybe this'll
give you an alternative:

Option Explicit
Sub testme()
Dim myDocumentsPath As String
Dim myDeskTopPath As String
Dim WSHShell As Object

Set WSHShell = CreateObject("WScript.Shell")
myDocumentsPath = WSHShell.SpecialFolders.Item("mydocuments")
myDeskTopPath = WSHShell.SpecialFolders.item("Desktop")

MsgBox myDocumentsPath & vbLf & myDeskTopPath

End Sub



mbmadiw wrote:

I recorded a macro that will save the file under another name, then
close it. It works great, but only on my computer.

The problem is that when you're using the file on another computer, the
macro won't work because the user has a different login name. The Save
destination includes my username, which is obviously different on
another computer. Is there a way around this?

Thanks!

--
mbmadiw
------------------------------------------------------------------------
mbmadiw's Profile: http://www.excelforum.com/member.php...o&userid=36153
View this thread: http://www.excelforum.com/showthread...hreadid=559288


--

Dave Peterson

mbmadiw[_2_]

Macro using Save As Problem
 

Thanks! I'll give 'er a try.


--
mbmadiw
------------------------------------------------------------------------
mbmadiw's Profile: http://www.excelforum.com/member.php...o&userid=36153
View this thread: http://www.excelforum.com/showthread...hreadid=559288



All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com