Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Q Q is offline
external usenet poster
 
Posts: 25
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Q Q is offline
external usenet poster
 
Posts: 25
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable Declaration R Tanner Excel Programming 20 June 16th 08 11:54 PM
VBA - variable declaration Jeff Excel Discussion (Misc queries) 3 January 9th 08 12:45 PM
2003--2007 require variable declaration Miri Excel Programming 1 August 7th 07 11:10 AM
variable declaration Janis Excel Programming 7 July 24th 07 01:46 AM
Variable Declaration?? Tom Ogilvy Excel Programming 1 August 8th 03 06:45 PM


All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"