PDA

View Full Version : Solved: Interaction between applications



silentsound
12-24-2009, 03:55 AM
(Apologies, I fear this may be in the wrong forum, but none of the forums seems particularly appropriate)

Is it possible to get vbas in two applications two interact? I only have experience of vba for excel but I presume there is some way to do this using vb. What I want to do is define a variable using values in excel cells then place this variable in another program. The crux of the matter is that copy and paste can't be used or at least only one cell can be copied and then pasted at a time.

Any help appreciated, hope you can understand my ramblings :)

Aussiebear
12-24-2009, 04:12 AM
What is the second program to which you want the data transferred to?

silentsound
12-24-2009, 04:22 AM
Sorry, this is a program specific to my work and I can't discuss that. i can tell you it has visual basic editor though if that helps. Perhaps you could tell me what the principle would be if the second program were access for example?

silentsound
12-24-2009, 07:05 AM
would be much appreciated!

Aussiebear
12-24-2009, 06:07 PM
Its a bit hard to tell you about much since you can't tell us what the second program is. However this much I can say. It is possible to transfers data between programs, but because the vba commands are slightly different no one set of commands works all the different Office suite.

Hence the need to know what the second program is based on. This way we can set up the relationship.

GreenTree
12-24-2009, 07:42 PM
You could use a .CSV file as an intermediary. Open a new workbook, copy the cells you want to pass to the other program into the new wb, save it as a .csv, and close it. The code in the second program can then open the .csv file as a text file and read in everything there.

Or concatenate all your cells into one long string (with appropriate separators) and put that on the clipboard for the second program to receive and parse out the individual variables.

G.T.

silentsound
12-25-2009, 03:02 PM
Thank you very much for your help so far. An important point that I should have mentioned is that each cell needs to go into a field. there are a series of these fields designed for manual text input but they don't interact like cells. i.e. pasting 5 cells into field 1 would result in subsequent cells overwriting each other and i would be left with only the content of cell 5.

What I was wondering essentially is whether there is a way to code with visual basic such that the vba in each application is enacted in the correct order? e.g. visual basic tells excel vba to copy the value of cell A1 and then tells vba in my second program to paste this in field 1, et cetera

hope that's clear
Merry Christmas to everyone reading this!

Aussiebear
12-25-2009, 04:26 PM
Yes it is possible.