lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I have saved a file in usb key. I opened the file from usb key. I ran the code below. I entered a new name, hello. The file was saved in C: drive under Documents, not in the usb key where the file originally was opened from! Why is that? Thank you very much
I have saved a file in usb key. I opened the file from usb key. I ran the code below. I entered a new name, hello. The file was saved in C: drive under Documents, not in the usb key where the file originally was opened from! Why is that? Thank you very much
Code:
Sub saveas_wb()
Dim x As Integer
Dim y
x = InputBox("which book you want to save")
y = InputBox("name")
Workbooks(x).SaveAs Filename:=y, FileFormat:=52
End Sub