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,
 

Some videos you may like

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Micron

Well-known Member
Joined
Jun 3, 2015
Messages
2,037
Office Version
  1. 365
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,998
Messages
5,622,102
Members
415,876
Latest member
csibonga2k17

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
Top