polska2180
Active Member
- Joined
- Oct 1, 2004
- Messages
- 384
- Office Version
- 365
Below is part of my script. My defult drive in excel is H:\ which is a network drive. My local drive is C:\ and that is where i'm trying to save this file C:\test\. Why is it not doing so and keeps saving to H:?
If there is nothing wrong let me know so that I can stop pulling out my hair and blame it on the PC, although I did try it on two different ones.
If there is nothing wrong let me know so that I can stop pulling out my hair and blame it on the PC, although I did try it on two different ones.
Code:
Range("A65000").End(xlUp).Select
Selection.Copy
Worksheets("Variables").Visible = True
Sheets("Variables").Select
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="/", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), _
TrailingMinusNumbers:=True
Range("E2").Select
ActiveCell.FormulaR1C1 = "=RC[-4]&"".""&RC[-3]&"".""&RC[-2]"
ChDir "C:\Test"
ActiveWorkbook.SaveAs Filename:=Range("e2").Value & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
'MsgBox ("You workbook was saved in the the following locatin " & "C:\Test" & "\" & Range("e2").Value & ".xls!")
msg = msg & vbCrLf & "Your workbook was saved in the the following locatin " & "C:\Test" & "\" & Range("e2").Value & ".xls!"
MsgBox msg, vbInformation, "VeoliaES - Important!!!!"
Worksheets("working").Visible = False
Worksheets("Variables").Visible = False
End Sub