0 registered (),
97
Guests and
0
Spiders online. |
Key:
Admin,
Global Mod,
Mod
|
|
|
#627992 - 01/05/07 01:17 PM
Re: VB scripting help
|
Member
Registered: 27/02/03
Posts: 857
Loc: Portland, OR
|
Originally posted by BurgPath: I am working with a script to pull information and place it in a text file which I then mail out automatically. I have to eventually pull this data into Excel so I need the info to be in the best possible format.
Heres a sample of where I'm at now: repout.writeline(objgroup.cn & " " & objmember.displayname & " " & objmember.samaccountname & " " & objmember.physicalDeliveryOfficeName & " " & objmember.title & " " & objmember.department & " " & objmember.mail)'
I'm using the "" to define the spacing but am open to suggestions. I'm new to vb scripts so maybe I'm missing something simple. Is there a way to create a tab delimited file? Personally, I'd go with a comma-separated-values file (.CSV) or perhaps a tab-delimited file. Separating your fields by a space isn't a good idea (because your field data may also have spaces in it) CSV file: "value","value","value" Tab file: "value" [tab character] "value" [tab character] "value" FYI, you can also use Chr(34) to create quotes, and the VB constant "VBTAB" to create a tab character. This page will help you a lot.
|
Top
|
|
|
|
#627993 - 01/05/07 04:39 PM
Re: VB scripting help
|
Member
Registered: 16/08/00
Posts: 557
Loc: Mount Vernon, WA, USA
|
Hey Kevin, it looks like you are trying to dump account info from AD, I have one that dumps user info to excel from AD, I will send you a copy tomorrow when I get to work.
Richard
_________________________
I come from a land down under.
|
Top
|
|
|
|
#627994 - 01/05/07 05:42 PM
Re: VB scripting help
|
Member
Registered: 23/03/01
Posts: 1906
Loc: San Jose, CA
|
Kevin, you might also try hunting through topics on the discussion forums at MrExcel.com , or even posting your VBA questions there. I learned of that website after attending an Excel training seminar.
|
Top
|
|
|
|
#627995 - 01/05/07 08:41 PM
Re: VB scripting help
|
Member
Registered: 02/04/03
Posts: 2163
Loc: LA (Lower Alabama)
|
Comma-separated files are good if you guarantee that the data field contents won't itself contain commas. Otherwise, tab-separated would be the way to go.
Comma separated:
repout.writeline(objgroup.cn & "," & objmember.displayname & "," & objmember.samaccountname & "," & objmember.physicalDeliveryOfficeName & "," & objmember.title & "," & objmember.department & "," & objmember.mail)
Tab separated:
repout.writeline(objgroup.cn & Chr$(9) & objmember.displayname & Chr$(9) & objmember.samaccountname & Chr$(9) & objmember.physicalDeliveryOfficeName & Chr$(9) & objmember.title & Chr$(9) & objmember.department & Chr$(9) & objmember.mail)
ETA: You may have to drop the $ signs, depending on the VBA version (i.e. Chr(9)).
_________________________
2002 Just Blue XE 4x4
|
Top
|
|
|
|
#627996 - 02/05/07 04:53 AM
Re: VB scripting help
|
Member
Registered: 25/05/02
Posts: 2146
Loc: Knoxville, Tn
|
PD / Dean, thanks for the links. Both have good info and will come in handy. Richard, thanks I'd like to see it. Even just to compare what I'm getting to see if its accurate. Xorand, one field has the users name, with a comma so your right, it would be a problem. Thanks for your help. I ended up finding info on 'vbtab' yesterday afternoon. It formated the file exactly as I needed. I have it saved as an .xls and the user can open it right up and do what she needs. Shes happy. (Which is good since its my wife  ) Thanks again guys.
|
Top
|
|
|
|
#627997 - 02/05/07 05:31 AM
Re: VB scripting help
|
Member
Registered: 16/08/00
Posts: 557
Loc: Mount Vernon, WA, USA
|
check your gmail Richard
_________________________
I come from a land down under.
|
Top
|
|
|
|
#627998 - 02/05/07 10:18 AM
Re: VB scripting help
|
Member
Registered: 25/05/02
Posts: 2146
Loc: Knoxville, Tn
|
|
Top
|
|
|
|
|