无论用户如何,如何将 Excel 工作簿保存到桌面? [英] How to save Excel Workbook to Desktop regardless of user?
问题描述
我有一个 Excel 工作簿,在表单按钮上单击我需要将工作簿的副本保存到用户的桌面.
I have an Excel Workbook that on Form Button click I need to save a copy of the workbook to the user's Desktop.
最初所有内容都将位于共享的网络文件夹中,但现在我有大约 6 个不同的用户,当他们单击按钮时,我需要将工作簿保存到他们各自的桌面上.
Originally everything was going to be on a shared Network folder, but now I have about 6 different users that when they click the button, I need to save the workbook to their individual Desktops.
他们是一种(在编码方面)保存到计算机桌面而无需指定个人用户(这需要我维护 6 个不同的工作簿文件)的方法吗?
Is their a way (coding-wise) to save to the machine Desktop without having to specify individual users (which would require me to maintain 6 different Workbook files)?
推荐答案
我认为这是获取桌面路径的最可靠方法,该路径并不总是与用户名相同.
I think this is the most reliable way to get the desktop path which isn't always the same as the username.
MsgBox CreateObject("WScript.Shell").specialfolders("Desktop")
这篇关于无论用户如何,如何将 Excel 工作簿保存到桌面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!