shrockworks xterraparts
XOC Decal
Newest Members
Glim, ChossWrangler, Patman, ChargedX, Randy Howerton
10084 Registered Users
Recent Posts
Shout Box

Who's Online
0 registered (), 97 Guests and 0 Spiders online.
Key: Admin, Global Mod, Mod
Topic Options
Rate This Topic
#627991 - 01/05/07 08:34 AM VB scripting help
BurgPath Offline
Member

Registered: 25/05/02
Posts: 2146
Loc: Knoxville, Tn
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?
_________________________
Kevin
- 2008.5 Titan SE 4x4
Burgy --- Nissan Offroad Association of the Southeast

Top
#627992 - 01/05/07 01:17 PM Re: VB scripting help
PDXterra Offline
Member

Registered: 27/02/03
Posts: 857
Loc: Portland, OR
Quote:
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
Richard Krenn Offline
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
XPLORx4 Offline
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.
_________________________
4x4 in uppercase is $X$!!!
1997 R50: VG33E/RE4R01A/TX10/3.7/R200A/ARB/4.636/H233B/ARB/4.636/321150R15

Top
#627995 - 01/05/07 08:41 PM Re: VB scripting help
Xorand Offline
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
BurgPath Offline
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 smile )

Thanks again guys.
_________________________
Kevin
- 2008.5 Titan SE 4x4
Burgy --- Nissan Offroad Association of the Southeast

Top
#627997 - 02/05/07 05:31 AM Re: VB scripting help
Richard Krenn Offline
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
BurgPath Offline
Member

Registered: 25/05/02
Posts: 2146
Loc: Knoxville, Tn
Got it, thanks Richard!
_________________________
Kevin
- 2008.5 Titan SE 4x4
Burgy --- Nissan Offroad Association of the Southeast

Top



shrockworks xterraparts
XOC Decal