Hank Costner wrote:
I'm having trouble hard-coding an array. It's called "filenames", and it's defined about half-way through. I've tried to assign values a few different ways, and right now, I'm trying to do it dynamically.
The error the compiler is giving me is Runtime error '13': Type Mismatch.
I defined filenames dynamically as a string (I think).
I'm not familiar with the SW coding environment. I normally use C++ and MatLab.
You can choose to create a VB.NET, VBA or C# macro. Just change the value in the Save As drop down list:
If you are fluent in C++, C# should be more comfortable (and way more powerful) than VBA.
To solve your VBA problem, remove the '() As String' from your declaration of fileNames. The Array() method returns a Variant so the variable can't be declared as a String.
What line is your error happening in the debugger?
Just a quick look through, it seems you haven't declared which item in the SalesPageToPrint or FabPagesToPrint should be in the PrintOut2 line. Should it not be SalesPagesToPrint(0) and FabPagesToPrint (0 or 1)?
Jim is correct... the Array() function returns a variant. To dynamically size an array in VBA you have to use the ReDim statement.
Also... It is indeed VBA. "End While" is not VBA. Wend is VBA.