Hi All,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
I was wondering if you could help me with the below.
<o></o>
I have a VBA project with 2 modules.
<o></o>
Module 1 opens 2 workbooks; 1 based off user input from an input box by taking the user input and concatenating it with the desired file path and opening a second file from a different file path in a difference location. (not really too important).
<o></o>
For example: user input might be 585006 and this is assigned to the variable “Fund”.
<o></o>
There is another variable “Tax” which is assigned the value(constant) “BT” so the concatenation would be 585006BT which is assigned to the variable “filename” and when concatenating with the variable “Filepath” opens the workbook named 585006BT.
<o></o>
This works fine and will open the workbook called 585006BT.xls and also opens the other workbook required as well.
<o></o>
<o></o>
I then pass the variable: essentially variable “Fund” and variable “Tax” to the variable “Feederfund” to be called from Module 2.
<o></o>
Note I have also declared “feederfund” as public in Module 1 so it can be passed to Module 2, to the variable “taxfile”
<o></o>
Module 2 for me is supposed to flick between 585006BT.xls and the other workbook as required. I want to use the variable “taxfile” to activate the window for the workbook it represents.
<o></o>
For example the code as it’s working now is :
<o></o>
<o></o>
I think the code should be something like
<o></o>
<o></o>
Where (“585006BT.xls”) is hardcoded (basically I recorded opening this file.) What I want to do is to be able to activate the file (585006BT.xls) based off the variable “taxfile” because the input box in module 1 will be used to select different files.
<o></o>
“taxfile” and “585006BT.xls” are basically the same thing. I can see that the taxfile value is 585006BT by hovering over it during the step through. I also know that windows is an object and maybe I’m not treating that correctly.
<o></o>
As an aside I will be working on a for each….next loop, to loop through a series of files instead of the input box but for now I’d to get the window to activate via variable rather than hardcoding as I’ll end up needing it eventually anyway.
<o></o>
I know this might seem like some sloppy coding but I guess us beginners tend to do things the hard way natch: inefficient when starting out.
Thanks for your help
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
I was wondering if you could help me with the below.
<o></o>
I have a VBA project with 2 modules.
<o></o>
Module 1 opens 2 workbooks; 1 based off user input from an input box by taking the user input and concatenating it with the desired file path and opening a second file from a different file path in a difference location. (not really too important).
<o></o>
For example: user input might be 585006 and this is assigned to the variable “Fund”.
<o></o>
There is another variable “Tax” which is assigned the value(constant) “BT” so the concatenation would be 585006BT which is assigned to the variable “filename” and when concatenating with the variable “Filepath” opens the workbook named 585006BT.
<o></o>
This works fine and will open the workbook called 585006BT.xls and also opens the other workbook required as well.
<o></o>
“Workbooks.Open Filepath & Filename”<o></o>
C:\blah|blah\585006BT.xls<o></o>
C:\blah|blah\585006BT.xls<o></o>
<o></o>
I then pass the variable: essentially variable “Fund” and variable “Tax” to the variable “Feederfund” to be called from Module 2.
<o></o>
Note I have also declared “feederfund” as public in Module 1 so it can be passed to Module 2, to the variable “taxfile”
<o></o>
Module 2 for me is supposed to flick between 585006BT.xls and the other workbook as required. I want to use the variable “taxfile” to activate the window for the workbook it represents.
<o></o>
For example the code as it’s working now is :
<o></o>
Windows("585006BT.xls").Activate,<o></o>
<o></o>
I think the code should be something like
<o></o>
Windows(“taxfile”).activate<o></o>
<o></o>
<o></o>
<o></o>
Where (“585006BT.xls”) is hardcoded (basically I recorded opening this file.) What I want to do is to be able to activate the file (585006BT.xls) based off the variable “taxfile” because the input box in module 1 will be used to select different files.
<o></o>
“taxfile” and “585006BT.xls” are basically the same thing. I can see that the taxfile value is 585006BT by hovering over it during the step through. I also know that windows is an object and maybe I’m not treating that correctly.
<o></o>
As an aside I will be working on a for each….next loop, to loop through a series of files instead of the input box but for now I’d to get the window to activate via variable rather than hardcoding as I’ll end up needing it eventually anyway.
<o></o>
I know this might seem like some sloppy coding but I guess us beginners tend to do things the hard way natch: inefficient when starting out.
Thanks for your help