VBA Output Creates Headers with Question Marks

liammoohan

Board Regular
Joined
Jan 11, 2008
Messages
72
Below is a screenshot of the module I have created which uses a query result to create a CSV file with the data in; the problem I have is that the first column header is always created with a question mark i.e. ?ACCOUNTNUMBER

1647959685766.png


Is there any reason why or how can I stop this from happening?

Thanks
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Methinks it might be because there is a leading non-transferable character (e.g. degrees character) or a space that's being included in the header value. Anything like that in your query results? I presume the question mark does not show up anywhere in your query results. There are no hyperlink values involved?
 
Upvote 0
Methinks it might be because there is a leading non-transferable character (e.g. degrees character) or a space that's being included in the header value. Anything like that in your query results? I presume the question mark does not show up anywhere in your query results. There are no hyperlink values involved?
It was a long time ago, and I don't know what application was creating it, but I do recall seeing the behavior that they are describing. And it wasn't anything special in the headers or data.
The first space of the entire CSV file would have a question mark (so it would be on the first line in the first space). So it would look something like this:
Rich (BB code):
?Field1,Field2,Field3,
a,b,c,
de,f,
x,y,z,

I wish I could remember the situation in which I saw it!
I don't know if it was something like a "print contol character" or something to that effect.

liam,
Are you experiencing something like that example output I showed?
Could you possibly do a screen print of the first few rows of your query results (being sure to show us the field names)?
 
Upvote 0

Forum statistics

Threads
1,221,528
Messages
6,160,346
Members
451,638
Latest member
MyFlower

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