?
Solved

Copying from one drive to another

Posted on 2002-03-28
6
Medium Priority
?
176 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 46

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 46

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 200 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month14 days, 8 hours left to enroll

771 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