![]() |
#1
|
|||
|
|||
![]()
So I've made enough progress in VBA to post this again. I'm trying to copy a sheet from another file in another folder. I can now make macros that copy data from another file within a file, but don't know how to copy the sheet when it's in another file.
Would someone modify this or say what code I should use? The path for the other folder would be "C:\Users\John Smith\Desktop\Test import file\DifferentFolderf\TestImportFile2" |
#2
|
|||
|
|||
![]()
try changing:
Code:
filename = ThisWorkbook.Path & Application.PathSeparator & "TestImportFile1.xlsx" Code:
filename = "C:\Users\John Smith\Desktop\Test import file\DifferentFolderf\TestImportFile2.xlsx" |
#3
|
|||
|
|||
![]() Quote:
Ok, so that worked, but this file will be used by others and kept in their folders under different user names. I tried something like; filename = "C:\Users" & uzer & "\Desktop\Test import file\DifferentFolderf\TestImportFile2.xlsx" And it did not work in my profile. The spreadsheet must be usable in other users profiles. |
#4
|
|||
|
|||
![]()
filename = "C:\Users\" & uzer & "\Desktop\Test import file\DifferentFolderf\TestImportFile2.xlsx"
|
#5
|
|||
|
|||
![]() Quote:
Even with the change it's not finding the folder. The new macro is below. Edit; and for some reason I added an extra "f" in the original post in "DifferentFolderf".... |
#6
|
|||
|
|||
![]()
1. No macro
2. the variable uzer should contain something; is it the right thing? |
#7
|
|||
|
|||
![]()
Sorry about that
|
#8
|
|||
|
|||
![]()
Nothing assigns any value to uzer. That's why it's not found.
|
#9
|
|||
|
|||
![]()
I don't understand the post. What should be the code so the spreadsheet can be used from any users account?
|
#10
|
|||
|
|||
![]()
Hi SoMany
Try uzer = Environ("Username") before the filename assign Or ,ideally, use a network drive location it will probably be more reliable |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
rsrasc | Excel Programming | 4 | 08-19-2018 04:00 PM |
![]() |
officeboy09 | Word | 6 | 09-26-2014 05:15 PM |
![]() |
Matt.M | Word | 2 | 04-02-2014 07:38 PM |
![]() |
ZGreyArea | Excel | 1 | 11-20-2013 10:12 AM |
Error Copying file or folder - Drag-N-Drop--> Network Shared | Kris.Fulgham | Outlook | 1 | 10-17-2005 09:02 AM |