Changing Path for SaveAs Functions

  • Thread starter Thread starter Rick B
  • Start date Start date
R

Rick B

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,
 
Post the macro for us to see.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Confirm SaveAs takes place. 6
Saveas Not Working 7
SaveAs 2
Loop and SaveAs Question 7
In XL VBA, Word Document SaveAs throws error 8
SaveAs 6
SaveAs? 4
xlsm SaveAs xls 4

Back
Top