PDA

View Full Version : Burn CD with VBA



GalileoGali
12-08-2010, 11:55 AM
Is there a way to automatize "CD BURNING WIZARD"?

I need to know how to burn cd using VBA
WITHOUT Nero, roxio, etc, only with Windows

Charlize
12-09-2010, 03:29 AM
This will add the files of a certain directory to the wait-list of files to be burned.
Sub burn_a_cd()
'Provide the drive letter of your CD burner
strDriveLetter = Application.InputBox("Driveletter : ", "Driveletter", "D", Type:=2) & ":\"
'Provide the source directory. We made one on the c drive
'and everything we put in this directory will be put on a cd
strSourceDirectory = "C:\TOBURN"
'Provide a volume name for your CD (16 characters max)
strCDName = Date
Const MY_COMPUTER = &H11
Set WShshell = CreateObject("WScript.Shell")
Set objShell = CreateObject("Shell.Application")
strBurnDirectory = WShshell.RegRead( _
"HKCU\Software\Microsoft\Windows\CurrentVersion\" _
& "Explorer\Shell Folders\CD Burning")
Set objFolder = objShell.Namespace(strSourceDirectory)
objShell.Namespace(strBurnDirectory).CopyHere objFolder.Items
objShell.Namespace(&H11&).ParseName(strDriveLetter).InvokeVerbEx ( _
"Write &these files to CD")
End SubCharlize

GalileoGali
12-09-2010, 04:03 AM
Thank you, Charlize

expanding:
is it possible to automate the actions the wizard?

Is it advisable to automate them?

Again, Thank You


VVVVVVVVVVVVVVVVVVVVVV
strCDName = Date '''why????

Charlize
12-09-2010, 05:48 AM
strCDName = Date '''why????You can give any name you want. As long as it's shorter then 17 characters (ie. 16 maximum). I'll probably used it for some kind of back-up routine.

Charlize

Charlize
12-09-2010, 05:55 AM
Why don't you say you crossposted your question ?

http://www.mrexcel.com/forum/showthread.php?p=2538748&posted=1#post2538748

Charlize