Hi Gurus,
I need some help with Find & replace functionality. Just to confirm, I tried many options without any luck. I am able to automate the whole process except for this functionality, forcing me to do the job manually. Requirement below:
1. Mapping worksheet contains a mapping table containing "Old Table Names" and "New Table Names"
2. Queries worksheet contains a list of SQL Queries which needs to be amended with the new table names.
3. Requirement - I need to loop through the Mapping table and do a find and replace in the Queries.
4. Complexity - I need to replace the table name only in the highlighted (bold) parts below:
SELECT dboOrders.OrderID, dboCustomers.CustomerName, dboOrders.OrderDate
FROM dboOrders
INNER JOIN dboCustomers ON dboOrders.CustomerID=dboCustomers.CustomerID;
When I use the normal Find/Replace, all the instances of dboOrders are being replaced, which doesn't serve the purpose for me.
Is there any way we can iterate through each word within the query and do a replace using VBA?
Any help with this macro is very appreciated.
Cheers,
Ravi.
I need some help with Find & replace functionality. Just to confirm, I tried many options without any luck. I am able to automate the whole process except for this functionality, forcing me to do the job manually. Requirement below:
1. Mapping worksheet contains a mapping table containing "Old Table Names" and "New Table Names"
2. Queries worksheet contains a list of SQL Queries which needs to be amended with the new table names.
3. Requirement - I need to loop through the Mapping table and do a find and replace in the Queries.
4. Complexity - I need to replace the table name only in the highlighted (bold) parts below:
SELECT dboOrders.OrderID, dboCustomers.CustomerName, dboOrders.OrderDate
FROM dboOrders
INNER JOIN dboCustomers ON dboOrders.CustomerID=dboCustomers.CustomerID;
When I use the normal Find/Replace, all the instances of dboOrders are being replaced, which doesn't serve the purpose for me.
Is there any way we can iterate through each word within the query and do a replace using VBA?
Any help with this macro is very appreciated.
Cheers,
Ravi.