Click here to Skip to main content
15,890,438 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: SHFormatDrive error Pin
DaveAuld7-Mar-10 1:45
professionalDaveAuld7-Mar-10 1:45 
AnswerRe: SHFormatDrive error [Update] Pin
DaveAuld7-Mar-10 3:29
professionalDaveAuld7-Mar-10 3:29 
AnswerRe: SHFormatDrive error Pin
Dave Kreskowiak7-Mar-10 3:43
mveDave Kreskowiak7-Mar-10 3:43 
AnswerRe: SHFormatDrive error Pin
Gagan.207-Mar-10 3:51
Gagan.207-Mar-10 3:51 
GeneralRe: SHFormatDrive error Pin
DaveAuld7-Mar-10 4:09
professionalDaveAuld7-Mar-10 4:09 
GeneralRe: SHFormatDrive error Pin
Gagan.208-Mar-10 2:23
Gagan.208-Mar-10 2:23 
GeneralRe: SHFormatDrive error Pin
DaveAuld8-Mar-10 2:34
professionalDaveAuld8-Mar-10 2:34 
GeneralRe: SHFormatDrive error Pin
Gagan.2013-Mar-10 3:56
Gagan.2013-Mar-10 3:56 
I have a VBScript that uses WMI to format a drive. I got the code from some site but it is not formatting my pen drvie and giving error while executing the script.

The code is below:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colVolumes = objWMIService.ExecQuery _
    ("Select * from Win32_Volume Where Name = 'G:\\'")

For Each objVolume in colVolumes
    errResult = objVolume.Format("NTFS")
Next


Here G: is my pen drive's drive name.

Suggest me how to format my pen drive.

Thanks.

Gagan
QuestionCopy a whole directory with files and subfolders with progressbar in vb Pin
majan116-Mar-10 17:31
majan116-Mar-10 17:31 
AnswerRe: Copy a whole directory with files and subfolders with progressbar in vb Pin
Luc Pattyn6-Mar-10 18:09
sitebuilderLuc Pattyn6-Mar-10 18:09 
GeneralRe: Copy a whole directory with files and subfolders with progressbar in vb Pin
majan117-Mar-10 11:50
majan117-Mar-10 11:50 
AnswerRe: Copy a whole directory with files and subfolders with progressbar in vb Pin
Gregory Gadow8-Mar-10 6:55
Gregory Gadow8-Mar-10 6:55 
Questionstoring input box values? Pin
toyman78516-Mar-10 13:41
toyman78516-Mar-10 13:41 
AnswerRe: storing input box values? Pin
Scott Dorman6-Mar-10 13:59
professionalScott Dorman6-Mar-10 13:59 
AnswerRe: storing input box values? Pin
Luc Pattyn6-Mar-10 14:39
sitebuilderLuc Pattyn6-Mar-10 14:39 
Questionprinting from file Pin
Daniel Engelkes6-Mar-10 11:35
Daniel Engelkes6-Mar-10 11:35 
QuestionRecognize Multiple keys being pressed Pin
Pugman8126-Mar-10 9:57
Pugman8126-Mar-10 9:57 
AnswerRe: Recognize Multiple keys being pressed Pin
Luc Pattyn6-Mar-10 10:14
sitebuilderLuc Pattyn6-Mar-10 10:14 
Questiontab spacing Pin
Daniel Engelkes6-Mar-10 9:34
Daniel Engelkes6-Mar-10 9:34 
AnswerRe: tab spacing Pin
Luc Pattyn6-Mar-10 10:18
sitebuilderLuc Pattyn6-Mar-10 10:18 
AnswerRe: tab spacing Pin
Dave Doknjas6-Mar-10 10:53
Dave Doknjas6-Mar-10 10:53 
QuestionURGENT--setting width of column in excel throgh code+vb Pin
chetan_agarwal5-Mar-10 22:57
chetan_agarwal5-Mar-10 22:57 
AnswerRe: URGENT--setting width of column in excel throgh code+vb Pin
Dalek Dave5-Mar-10 23:35
professionalDalek Dave5-Mar-10 23:35 
Questiontext box in VB application Pin
chetan_agarwal5-Mar-10 19:46
chetan_agarwal5-Mar-10 19:46 
AnswerRe: text box in VB application Pin
DaveAuld5-Mar-10 20:35
professionalDaveAuld5-Mar-10 20:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.