用于将工作簿保存到一个驱动器的vba宏代码。 [英] vba macros code for saving workbook to one drive.
本文介绍了用于将工作簿保存到一个驱动器的vba宏代码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望创建一个用于保存到onedrive的宏。我已经在word中应用了这个代码并且它工作正常但是现在我在excel中尝试了这个代码并且它不起作用。你可以帮助brotha吗?
I wold like to create a macro for saving to onedrive. i have applied this code in word and it worked fine but now i have tryed this code in excel and it does not work. can you help a brotha out?
Dim OriginalName As String
  ; OriginalName = ActiveDocument.FullName
ActiveDocument.SaveAs" C:\ Users \ JeffL \ OneDrive \" + ActiveDocument.Name
ActiveDocument .SaveAs OriginalName
推荐答案
如果要获取Excel文件的文件名,请使用"ActiveWorkbook",而不是"ActiveDocument"。
并添加一个扩展名(.xlsm)。
Hi,
If you want to get a file name of Excel file, use "ActiveWorkbook", instead of "ActiveDocument".
and add an extension (.xlsm).
OriginalName = ActiveWorkbook.Name + ".xlsm"
Regards,
Ashidacchi
Regards,
Ashidacchi
这篇关于用于将工作簿保存到一个驱动器的vba宏代码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文