Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Can you call VBScript code from VBA?

The following Code stored in a text file with a .VBS extension calls in the
file details I want to access and eventually update. The file detail I am
trying to change is "Track Number" (for music files recorded from a CD) the
FileSystemObject does not return this item in its structure.

The script works by dragging and dropping a folder onto the .VBS icon. It
was writing the data out to a text file (the code for that was snipped-out).

How do I modify the code so that I can pass the folder in as string data.

Set objShell = CreateObject("Shell.Application")
Set Ag=Wscript.Arguments
Set Fldr=objShell.NameSpace(Ag(0))
Set FldrItems=Fldr.Items
' shows the heading names... up to 50 of them
For x = 0 to 50
t1 = t1 & Fldr.GetDetailsOf(vbnull, x) & vbtab
Next
ts.write FLDR.self.path &vbcrlf
ts.Write T1 & vbcrlf
T1=""

'shows the data stored in each of the file's details
For Each FldrItem in FldrItems
For x = 0 to 50
t1 = t1 & Fldr.GetDetailsOf(FldrItem, x) & vbtab
Next
Next

*********
Is there some way to have the fso return ALL file details? I could use it,
but so far namespace is the only method I have found that can get me to the
specific data I want to see/update.

And I run almost all my code from Excel-VBA.
(im still very new to VB and scripting)
--
Regards,
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Can you call VBScript code from VBA?

Converted to VBA and lightly tested:
Option Explicit

Sub testIt()
Dim objShell, Fldr, FldrItems, x, ts, t1, FldrItem
Set objShell = CreateObject("Shell.Application")
'Set Ag = Wscript.Arguments
'Set Fldr = objShell.Namespace(Ag(0))
Set Fldr = objShell.Namespace("c:\temp")
Set FldrItems = Fldr.Items
' shows the heading names... up to 50 of them
For x = 0 To 50
t1 = t1 & Fldr.GetDetailsOf(vbNull, x) & vbTab
Next
Debug.Print Fldr.self.Path & vbCrLf
Debug.Print t1 & vbCrLf
t1 = ""

'shows the data stored in each of the file's details
For Each FldrItem In FldrItems
t1 = ""
For x = 0 To 50
t1 = t1 & Fldr.GetDetailsOf(FldrItem, x) & vbTab
Next
Debug.Print t1
Next
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
The following Code stored in a text file with a .VBS extension calls in the
file details I want to access and eventually update. The file detail I am
trying to change is "Track Number" (for music files recorded from a CD) the
FileSystemObject does not return this item in its structure.

The script works by dragging and dropping a folder onto the .VBS icon. It
was writing the data out to a text file (the code for that was snipped-out).

How do I modify the code so that I can pass the folder in as string data.

Set objShell = CreateObject("Shell.Application")
Set Ag=Wscript.Arguments
Set Fldr=objShell.NameSpace(Ag(0))
Set FldrItems=Fldr.Items
' shows the heading names... up to 50 of them
For x = 0 to 50
t1 = t1 & Fldr.GetDetailsOf(vbnull, x) & vbtab
Next
ts.write FLDR.self.path &vbcrlf
ts.Write T1 & vbcrlf
T1=""

'shows the data stored in each of the file's details
For Each FldrItem in FldrItems
For x = 0 to 50
t1 = t1 & Fldr.GetDetailsOf(FldrItem, x) & vbtab
Next
Next

*********
Is there some way to have the fso return ALL file details? I could use it,
but so far namespace is the only method I have found that can get me to the
specific data I want to see/update.

And I run almost all my code from Excel-VBA.
(im still very new to VB and scripting)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i call sub or function in vba code xxx Excel Discussion (Misc queries) 3 June 28th 06 11:47 AM
How do I call a method in VB from Excel with JUST code? Doseeson Excel Programming 2 May 28th 05 12:26 AM
How do I call a method in VB from Excel with JUST code? K Dales[_2_] Excel Programming 0 May 27th 05 09:57 PM
VBScript code behind Excel jjjjj Excel Programming 2 November 23rd 04 10:36 PM
call VBA compiled code within vba Les[_5_] Excel Programming 1 September 26th 03 06:27 PM


All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"