eldnahmurof
Programmer
Hi,
I have successfully used VBA code within Excel to link to our database and retrieve data (I used record macro to get connection stuff). It uses QueryTable and outputs to a sheet within the workbook.
Now I have been asked to write this as vbscript instead. I have noticed that my Account Number field is not preserving leading zeroes (e.g. "01102..." becomes "1102...") and at first thought it was my connection string (maybe some difference between VBA and VBS) but then realized the data looks ok if I open it in Notepad.
Hence my question now is this. Rather than output to csv and then have the user manually open the file, where the data format is wrong, can I open the output directly in Excel and keep the "text" formatting I require? Should I write record by record to the spreadsheet, or rather continue to output to my text csv file and then open that file in Excel? The output needs to be csv-like, i.e. one field per cell.
I'm Googling for examples but as this is the first time I've used VBscript any help is most welcome!
Thanks,
Bob
I have successfully used VBA code within Excel to link to our database and retrieve data (I used record macro to get connection stuff). It uses QueryTable and outputs to a sheet within the workbook.
Now I have been asked to write this as vbscript instead. I have noticed that my Account Number field is not preserving leading zeroes (e.g. "01102..." becomes "1102...") and at first thought it was my connection string (maybe some difference between VBA and VBS) but then realized the data looks ok if I open it in Notepad.
Hence my question now is this. Rather than output to csv and then have the user manually open the file, where the data format is wrong, can I open the output directly in Excel and keep the "text" formatting I require? Should I write record by record to the spreadsheet, or rather continue to output to my text csv file and then open that file in Excel? The output needs to be csv-like, i.e. one field per cell.
I'm Googling for examples but as this is the first time I've used VBscript any help is most welcome!
Thanks,
Bob