versa005
10-07-2010, 03:19 AM
Hi,
I am new to VBA and I am writing a macro to generate grocery list. I have attached the same as a zip file. (Please extract the file and open the same.)
Steps to follow to generate the list are
1) Open the excel with macro enabled
2) Enter the quantity and brand requrired for that month. Example: If i want gillete shaving foam, i have to enter next to Shaving foam cell, Gillete in brand , qty 1
3) after entering all items, press generate list button
4) the list is generated in word document
5) clearlist will clear the brands and quantity
Method:
1) For generating the list, in VBA, i read all the qty columns in the excel, if it is zero, i pick the brand and item name
2) with this, i form a temporary table in excel and define it as a range
3) the range is then selected and copied into a word document
Question:
1. I am able to open the macro with ALT F11. But i dont want other to view my macro. How this to be done?
2. Also while performing final copy, i am unable to make the table AUTOFIT TO CONTENTS in WORD. I used the attribute
With objWordDoc.tables
TablesAutofit = AUTOFIT_CONTENTS
End With
Please help... thanks a lot
I am new to VBA and I am writing a macro to generate grocery list. I have attached the same as a zip file. (Please extract the file and open the same.)
Steps to follow to generate the list are
1) Open the excel with macro enabled
2) Enter the quantity and brand requrired for that month. Example: If i want gillete shaving foam, i have to enter next to Shaving foam cell, Gillete in brand , qty 1
3) after entering all items, press generate list button
4) the list is generated in word document
5) clearlist will clear the brands and quantity
Method:
1) For generating the list, in VBA, i read all the qty columns in the excel, if it is zero, i pick the brand and item name
2) with this, i form a temporary table in excel and define it as a range
3) the range is then selected and copied into a word document
Question:
1. I am able to open the macro with ALT F11. But i dont want other to view my macro. How this to be done?
2. Also while performing final copy, i am unable to make the table AUTOFIT TO CONTENTS in WORD. I used the attribute
With objWordDoc.tables
TablesAutofit = AUTOFIT_CONTENTS
End With
Please help... thanks a lot