Macro will not save file

meatball

Board Regular
Joined
Jun 20, 2005
Messages
133
Hello All,
I have this macro which copies info from ThisWorkbook to 2 other workbooks opened by the macro. I have been able to work the code and have a new file saved to a folder but I can not get it to save to the folder that ThisWorkbook is in. Any ideas where the problem is?
This comes from a recorded macro that has been modified.
Code:
Sub Exacta()
'
' Exacta Macro
' Macro recorded 2/27/2009 by David D
'

'
    
    Workbooks.Open Filename:="Z:\Gould Southern Info\GA Kits\Forms & Templates\RFQ ---- to EX.xls"
    ThisWorkbook.Activate
    Sheets("RFQ to EX BOM Pg 2").Select
    Range("A15:F" & Range("B2000").End(xlUp).Row).Select
    Selection.Copy
    Windows("RFQ ---- to EX.xls").Activate
    Sheets("BOM").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Range("A2").Select
    ThisWorkbook.Activate
    Range("A2").Select
    Sheets("RFQ to Exacta PG 1").Select
    Columns("A:H").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("RFQ ---- to EX.xls").Activate
    Sheets("Cover").Select
    Columns("A:A").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.Run "ExSaveAs()"
    ThisWorkbook.Activate
    Workbooks.Open Filename:="Z:\Gould Southern Info\GA Kits\Forms & Templates\RFQ ---- Austin Foam.xls"
    ThisWorkbook.Activate
    Sheets("Foam Cost").Select
    Range("A1:H22").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("RFQ ---- Austin Foam.xls").Activate
    Sheets("Sheet1").Select
    Range("b33").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.Run "AustinSaveAs()"

    Range("d56:d59").Select
    Application.CutCopyMode = False
    Selection.Copy
    ThisWorkbook.Activate
    Sheets("Foam Cost").Select
    Range("c24").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    
    
    
    End Sub

Sub AustinSaveAs()
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "RFQ " & Range("c34") & " " & Range("c37") & ".xls"
End Sub

Sub ExSaveAs()
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "RFQ " & Range("c34") & " " & Range("c37") & ".xls"
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi meatball,

Assuming the rest of your code is ok try changing your saveas code to:

Code:
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & "RFQ " & Range("c34") & " " & Range("c37") & ".xls"
End Sub
Code

"ActiveWorkbook.SaveAs ThisWorkbook.Path &" works ok for me

ColinKJ
 
Upvote 0
CKJ,
Thanks for replying. Unfortunatly that did not work. I thought it might have to do with trying to save to folder that is on a password protected server so I copied it to My Documents and tried but no luck. The files are opened and info is pasted but after the macro is done the 2 files have not changed names and there are no new files in the folder.
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,835
Members
449,051
Latest member
excelquestion515

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