Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable declaration in Excel 2007
Hello
I have a macro from Excel 2003, and it works fine in Excel 2003. The macro processes some data and saves the output Excel file to a folder. In the macro, I have a variable that stores the output path. The macro uses the value in the output path variable to save the Excel file. For some reason, when running this macro in Excel 2007, the output path variable is blank! The variable declaration is in the middle of the subroutine in the macro and the variable assignment to the output path is done right afterward. I did a search on the project, thinking perhaps elsewhere in the code that causes the output path to be blank, but nowhere else uses this variable but this subroutine. Later, when I moved this variable declaration and assignment to near the beginning of the subroutine, it works fine. The location of variable declaration in Excel 2007 matters? Thanks, Q |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable declaration in Excel 2007
Just curious. Do you have Option Explicit at the beginning of your modules
and have you declared all variables? HTH, Barb Reinhardt "Q" wrote: Hello I have a macro from Excel 2003, and it works fine in Excel 2003. The macro processes some data and saves the output Excel file to a folder. In the macro, I have a variable that stores the output path. The macro uses the value in the output path variable to save the Excel file. For some reason, when running this macro in Excel 2007, the output path variable is blank! The variable declaration is in the middle of the subroutine in the macro and the variable assignment to the output path is done right afterward. I did a search on the project, thinking perhaps elsewhere in the code that causes the output path to be blank, but nowhere else uses this variable but this subroutine. Later, when I moved this variable declaration and assignment to near the beginning of the subroutine, it works fine. The location of variable declaration in Excel 2007 matters? Thanks, Q |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable declaration in Excel 2007
Barb:
Yes and yes. Q "Barb Reinhardt" wrote: Just curious. Do you have Option Explicit at the beginning of your modules and have you declared all variables? HTH, Barb Reinhardt "Q" wrote: Hello I have a macro from Excel 2003, and it works fine in Excel 2003. The macro processes some data and saves the output Excel file to a folder. In the macro, I have a variable that stores the output path. The macro uses the value in the output path variable to save the Excel file. For some reason, when running this macro in Excel 2007, the output path variable is blank! The variable declaration is in the middle of the subroutine in the macro and the variable assignment to the output path is done right afterward. I did a search on the project, thinking perhaps elsewhere in the code that causes the output path to be blank, but nowhere else uses this variable but this subroutine. Later, when I moved this variable declaration and assignment to near the beginning of the subroutine, it works fine. The location of variable declaration in Excel 2007 matters? Thanks, Q |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable declaration in Excel 2007
You're going to have to post your code.
"Q" wrote: Barb: Yes and yes. Q "Barb Reinhardt" wrote: Just curious. Do you have Option Explicit at the beginning of your modules and have you declared all variables? HTH, Barb Reinhardt "Q" wrote: Hello I have a macro from Excel 2003, and it works fine in Excel 2003. The macro processes some data and saves the output Excel file to a folder. In the macro, I have a variable that stores the output path. The macro uses the value in the output path variable to save the Excel file. For some reason, when running this macro in Excel 2007, the output path variable is blank! The variable declaration is in the middle of the subroutine in the macro and the variable assignment to the output path is done right afterward. I did a search on the project, thinking perhaps elsewhere in the code that causes the output path to be blank, but nowhere else uses this variable but this subroutine. Later, when I moved this variable declaration and assignment to near the beginning of the subroutine, it works fine. The location of variable declaration in Excel 2007 matters? Thanks, Q |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Variable Declaration | Excel Programming | |||
VBA - variable declaration | Excel Discussion (Misc queries) | |||
2003--2007 require variable declaration | Excel Programming | |||
variable declaration | Excel Programming | |||
Variable Declaration?? | Excel Programming |