Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

microsoft-access-courses - assigning dimension

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » microsoft-access-courses - Assigning a dimension

microsoft-access-courses - Assigning a dimension

ResolvedVersion Standard

Oliver has attended:
Excel VBA Intro Intermediate course

Assigning a dimension

Hi,

I've recently changed PC's and it seems that I am now required to populate ".xls" when assigning an excel spreadsheet as dimension in code. For example, on my old computer, in code when i have two excel spreadsheets open and previously assigned "book1" as a dimension "D_Filename" and used the command;
Windows(D_Filename).Activate
the "book1" spreadsheet is activated.
Now I am required to assign "book1.xls" as the dimension, otherwise I receive "Run-time error `9`: Subscript out of range".

I am using the same version of Excel and VBA and cannot understand why the code doesn't work without ".xls" on my new computer - Are you able to assist?

Many thanks,
Oliver

RE: Assigning a dimension

Hi Oliver,

I'm not sure why that would be.

Perhaps it's to do with a Windows setting. Eg. I do know you can change your file view settings to 'hide file extensions for known file types', so perhaps it's that or some other Windows setting.

Is it not possibly to retype your code with the .xls part of the filename? Or are there many places you need to do this?

Another option is to assign a variable with value ".xls" and append this to all of your filenames. Then, if you are ever giving code to another colleague/computer and it requires the ".xls" part to NOT be there, you just unassign that one variable, effectively appending 'nothing' to all your filenames throughout all your code.

I hope this gives you some help. Sorry I can't offer any more explanation. Perhaps Microsoft can help?

Regards, Rich

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Creating custom lists

In Excel if you type in January in a cell, you can then copy this cell to replicate Febraury, MArch, April etc.

This list has come from Tools- options and Custom lists.

Therefore to save time and create your own list you can click on New (in Tools and custom list tab) and type out the lsit that you want copied quickly.

All you have to do is then type in the 1st word and you will be able to copy the rest of the list quickly.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.