access export excel using vba with conditions

bigmac1

New Member
Joined
Oct 9, 2016
Messages
17
hello all, i have some problems that i hope you can help me with.
i have a access database on which i have a subform that the user can hide or unhide columns by clicking on tick boxes on the main form,(some columns not required for different subforms)
i have a button that can export the data in subform to excel and if needs be create the folders to store it in, this all seems to work, (the code for doing this i got from some site that i cannot remember, it was a long time ago)
1 when it exports to excel it shows all columns, even the ones that has been hidden, how do i stop this?
2 it also exports some textboxes onto the that i have requested to do (company name, project, drawing)this works fine, but could i create a header in vba and place the textboxes on to it ? if so how please,
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Whatever is loaded into the subform will be exported. Trick then is to alter what loads into the subform - either load different forms if it's a form that you're loading, or if you're loading a query into a datasheet, load a different query that reflects what you want to see.

As for your second question, I'd forget about altering form design via code. You can alter a header height in vba once you've set it in design, but you cannot add or remove controls via code unless you put the form in design view first - even if that is being done in code. Can't see why you'd want to do that.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top