Save to specified folder, Not original folder

andymalan

Board Regular
Joined
Feb 22, 2017
Messages
128
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
I have some code that allows the user to select a file from a folder named CSV ("\Desktop\Excalibur QCP21\ExcaliburProPlus\CSV Files")

I want to save as a new workbook to a different folder ("C:\Desktop\Excalibur QCP21\02_ImportToExcalibur")
When I run the code it executes without errors, and the file is saved........but to the wrong folder nl. the csv folder

here is the code that saves the workbook

Sub aSaveToTheNewName()
'Save the new file using the name created in Q2

Dim ThisFile As String
Dim strFileName As String
Dim Usersname As String
Dim myFileName As String
Dim Path As String

'ThisFile = Range("Q2").Value
'ActiveWorkbook.SaveAs FileName:=ThisFile
', FileFormat:=xlNormal
Application.DisplayAlerts = False
Usersname = Environ("USERNAME")
strFileName = "C:\Users\" & Usersname & _
"C:\Desktop\Excalibur QCP21\02_ImportToExcalibur"
myFileName = Range("Q2")
ActiveWorkbook.SaveAs FileName:=Path & myFileName & ".xlsx", FileFormat:=51

ThisFile = Range("Q2").Value
ActiveWorkbook.SaveAs FileName:=ThisFile

I will be grateful for your help
 
I was happy to help. I am glad @Joe4 got you squared away.
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,214,665
Messages
6,120,804
Members
448,990
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top