Solved

Copying from one drive to another

Posted on 2002-03-28
6
175 Views
Last Modified: 2010-05-02
is there a way Visual Basic can copy the value from A1 that is on H:\Forms\RDS_Access.xls to C:\RDS_Access.xls?
The file on drive H would be closed, im not sure if thats a problem.
I know formulas can be linked to another file without that file being opened.
Here is the macro that I wrote BUT I need to change it to copy the value from A1 Cell that will now be on a different drive versus copying from one worksheet tab to another.
Sub Enter_Po_Number()
   Sheets("P.O. Nos").Visible = True
   Sheets("P.O. Nos").Select
   Range("A1").Select
   Selection.Copy
   Sheets("Access & Couplers").Select
   Range("I9").Select
   ActiveSheet.Paste
   Sheets("P.O. Nos").Select
   Rows("1:1").Select
   Application.CutCopyMode = False
   Selection.Delete Shift:=xlUp
   ActiveWindow.SelectedSheets.Visible = False
   Sheets("Access & Couplers").Select
End Sub

0
Comment
Question by:He4Giv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 6904191
use a formula in your C: spreadsheet like:
='H:\Forms\[RDS_Access.xls]Sheet1'!$A$1
0
 

Author Comment

by:He4Giv
ID: 6904257
A formula wont work because once Cell A1 is copied the macro needs to go back to that file and delete Row 1 so that number cant be used again...This form Im using has a macro button that is labeled "Enter P.O.". when users open this form and press the macro button it copies this number from ROW 1 which then has to be deleted so the next number on ROW 2 now moves up to ROW 1 and becomes available.

In this File I have A1 thru A200 filed in with Purchase order numbers and each time the macro button is pressed it copies A1 from that file to this open file then it goes back and deletes ROW 1 (whats on ROW 2 now moves up to ROW 1).

0
 
LVL 45

Expert Comment

by:aikimark
ID: 6904375
1. Instead of using the clipboard, store the PO number in a variable.  Alternatively, you can use the ?datacache? object as a temporary storage area.
2. You will need to open and close the PO workbook.  You can do this either in the target Excel session or use Excel automation.  The former is simpler.
3. Be sure to save the PO-number workbook after deleting the first row.

Example:
application.open "H:\Forms\RDS_Access.xls"
strVar = Activesheet.Cells(1,1).Text
Activesheet.rows(1).delete
application.close save:=True     'you need to verify the syntax
activesheet.cells(1,1) = strVar
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 50 total points
ID: 6904571
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6904572
0
 

Author Comment

by:He4Giv
ID: 6905982
Very informative to show examples from Microsoft's library
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question