I broke Save As

iwilli

New Member
Joined
Jan 31, 2012
Messages
43
Still learning. I'm trying to create a Macro that several different people will use on different computers. The problem is if I use the "Save As" then it saves the files to my user. This causes the macro not to work on anyone's computer other than mine. What am i doing wrong?

Code:
Sub EAR_UPS_CONTACT_IMPORT()
'
' EAR_UPS_CONTACT_IMPORT Macro
' Creates the .csv file to upload to UPS for EARs
'

'
    Sheets("CSEXPORT").Select
    Cells.Select
    Selection.Value = Selection.Value
    Range("A1").Select
    ActiveWorkbook.SaveAs Filename:="C:\Users\iwilli\Desktop\EAR_UPS_Import.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
End Sub
 
where is your macro located? in module or in the worksheet?

do you have a button to run the macro?
 
Upvote 0
Maybe ...

Code:
Sub EAR_UPS_CONTACT_IMPORT()
    With Worksheets("CSEXPORT").UsedRange
        .Goto .Range("A1")
        .Value = .Value
        .Worksheet.Parent.SaveAs Filename:="C:\Users\" & _
                                           Environ("username") & _
                                           "\Desktop\EAR_UPS_Import.csv", _
                                 FileFormat:=xlCSV
    End With
End Sub
 
Upvote 0
You can try

Filename:="C:\Users\" & Application.UserName & "\Desktop\EAR_UPS_Import.csv"
 
Upvote 0
Save it after you Save As or vice versa.

<table border="0" cellpadding="0" cellspacing="0" width="342"><colgroup><col width="342"></colgroup><tbody><tr height="17"> <td style="height:12.75pt;width:257pt" height="17" width="342">You can't do one thing. XLAdept</td> </tr></tbody></table>
 
Upvote 0
shg
Your suggestions gave me runtime errors when I used it on my neighbors computer. But it works on mine. Go figure
 
Upvote 0

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