Monster1979
New Member
- Joined
- May 26, 2013
- Messages
- 3
Hi everybody.
I have made an invoice in excel that make a new invoice number when opening etc. Everything is working fine but i need to save the invoice in a specified folder, which is also working fine. My problem is when i copy my whole work folder to usb and work on it from my laptop it still saves that file "With the written code" To D:\Drive and not to the given usb I:\ drive. Is there any code that i can write to save it to the current drive you are working from. Here is a sample of my code.
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
ActiveSheet.Copy
NEWFN = "D:\Manie Hansen\Invoices\" & "Invoice " & Range("M11").Value & " " & Range("E19").Value & ".xlsx"
ActiveWorkbook.SaveAs NEWFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
End Sub
What i want is for the d:\Manie Hansen\..... to change to whatever drive number the USB get on another pc. For example I:\Manie Hansen. without having to change the code from pc to pc.
Thank You
I have made an invoice in excel that make a new invoice number when opening etc. Everything is working fine but i need to save the invoice in a specified folder, which is also working fine. My problem is when i copy my whole work folder to usb and work on it from my laptop it still saves that file "With the written code" To D:\Drive and not to the given usb I:\ drive. Is there any code that i can write to save it to the current drive you are working from. Here is a sample of my code.
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
ActiveSheet.Copy
NEWFN = "D:\Manie Hansen\Invoices\" & "Invoice " & Range("M11").Value & " " & Range("E19").Value & ".xlsx"
ActiveWorkbook.SaveAs NEWFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
End Sub
What i want is for the d:\Manie Hansen\..... to change to whatever drive number the USB get on another pc. For example I:\Manie Hansen. without having to change the code from pc to pc.
Thank You