Solved

Copying from one drive to another

Posted on 2002-03-28
6
169 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now