By using expertatexcel.com you agree to our
cookie policy
, We and our partners operate globally and use cookies, for multiple purposes
Close
expertatexcel.com
Home
Macro Intro
What can Excel do?
Learning >
Learning
Excel Books
Basic concepts
Immediate window
Macros 101
Syntax
Use existing code
Hello world
Math
formulas
Functions
Modifying Recorded Macros
Macro Recorder
Selecting
Moving data
Formatting
Clipboard
Range names
Filters
Sorting
Fill
Combining
Hyperlinks
Comments
Options
Vlookup
Conditional Formatting
Data validation
Pivot Tables
Charts
Charts
Macro Programming
Debugging
Strings
Active
This
vba statements
VBA functions
Run stuff
Object Model
Workbook
Sheet
Cells
Rows
Column
Range
Selection
Methods
Properties
Events
Collections
Chart
Software Dev
Variables
Data types
variables/scope
Conditionals
Loops
functions/sub
Arrays
testing
Batch
Software dev techniques
Backup/Recovery
Documentation
Wrappers
webservice
Refactor
Problems
#Errors
Problems
Too Slow/Optimize
Error handling
Problem Solving Method
Someone else's sheet
complex formula
Misc
Date/times
Code Generation
Random
Shortcuts
Forms
Special Chars
Customize your training
Work and learn
Projects/Apps
Reporting
Sample projects
Reconcliation
Adjusting data
Generate Slides
Special Characters
External
Outlook
Web
Database
Files
PPT
Word
API
Objects
Script host
Dos
Bloomberg
JIRA
Input Spreadsheets or files
Learning Tracks
Stocks
Bitcoin
Sports
Job
Productivity
Project Management
Tracking
Health
Games
Programmer
GenerateExcelFiles from a db - udf
🔝
This routine will generate multiple Excel files from a sheet with Query information
Routine
append SQL to sheet name
delete sheets that were creating
ignore requests
Set column variable
Excel Output
SQL File
Parm1
SQL Name
Value1
Parm2
Value2
Datasource
SheetName
Methodology Sheet
VBA Code
Glossary Sheet
for each row in sheet
skip if ; in first char of sqlname
Log the step
GenerateExcelInputFileGeneric
if return is 0
GenerateExcelInputFileGeneric
Set the datasource
Check if the excel output exists
Check if SQL file exists
Open the SQL file
Remove SQL Comments
Process include
Update the Parms $parm1, $parm2
Create directories
Save the SQL after substitution
Clean up the SQL
ProcessSQL
Save the output to a new workbook
Add a Pivot for special case
Add Confidential sheet
Add Methodology sheet
Add Glossary Sheet
Run the VBA code if set
Remove RangeNames '