ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing Path for SaveAs Functions (https://www.excelbanter.com/excel-programming/401741-changing-path-saveas-functions.html)

Rick B

Changing Path for SaveAs Functions
 
Hello
I am trying to write code that automatically saves a file. Everything works
fine until I copy and paste the file in another folder. When the macro saves
the file it automatically defaults to the original location (where the code
was originally written)and not the folder in which it is currently in.
How do I change this, without being specific to a drive or folder?

I have posted 1 other time in the past and the help i recieved was right on,
first time. I appreciate any help I can get.

Thanks in advance,
--
Rick B

Bob Phillips

Changing Path for SaveAs Functions
 
Post the macro for us to see.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Rick B" wrote in message
...
Hello
I am trying to write code that automatically saves a file. Everything
works
fine until I copy and paste the file in another folder. When the macro
saves
the file it automatically defaults to the original location (where the
code
was originally written)and not the folder in which it is currently in.
How do I change this, without being specific to a drive or folder?

I have posted 1 other time in the past and the help i recieved was right
on,
first time. I appreciate any help I can get.

Thanks in advance,
--
Rick B




Rick B

Changing Path for SaveAs Functions
 
Thanks Bob,
Here is all the code that I am using.
__________________________________________________ _____________________
Sub SetupPO()
'
' SetupPO Macro
' Macro recorded 10/11/2007 by Rick B
'

'This macro works to open the template, label it and save it correctly. Do
not change it.

Workbooks.Open Filename:="G:\ACTIVE CONTRACTS\Job setup\Purchase
Orders\P.O. & Sub\New PO.xls", UpdateLinks:=3
Windows("P.O. Log.xls").Activate
ActiveCell.Offset(0, -2).Range("A1").Select
Selection.Copy
Windows("New PO.xls").Activate
Range("F13").Select
'ActiveCell.Offset(-4, -8).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("P.O. Log.xls").Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Windows("New PO.xls").Activate
Range("C16").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("N17").Select
ActiveWorkbook.SaveAs Filename:=ActiveCell.Text, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
Range("I13").Select

End Sub
-----------------------------------------------------------------------------------------------------------
Cell reference "N17" contains the basic file name that this file is being
named as. It does not however contain the full path of the new file.
I hope this helps.
--
Rick B


"Bob Phillips" wrote:

Post the macro for us to see.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Rick B" wrote in message
...
Hello
I am trying to write code that automatically saves a file. Everything
works
fine until I copy and paste the file in another folder. When the macro
saves
the file it automatically defaults to the original location (where the
code
was originally written)and not the folder in which it is currently in.
How do I change this, without being specific to a drive or folder?

I have posted 1 other time in the past and the help i recieved was right
on,
first time. I appreciate any help I can get.

Thanks in advance,
--
Rick B






All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com