Solved

Burn CD from MS Access

Posted on 2014-04-06
3
817 Views
Last Modified: 2014-04-06
Hi,

I'm looking at adding a burn files to CD option in my MS Access database.  My database includes the path to the folder with the files which need to be burned to the CD.

The code I have found is below, however, it doesnt seem to work.  It errors out at :

strDriveLetter = Application.InputBox("Driveletter : ", "Driveletter", "D", Type:=2) & ":\"  

Can anyone help?

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 Sub

Open in new window

0
Comment
Question by:anthonytr
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 39981263
This should do:

strDriveLetter = InputBox("Driveletter: ", "Driveletter", "D") & ":\"

/gustav
0
 

Author Comment

by:anthonytr
ID: 39981271
That's great - thank you
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 39981277
You are welcome!

/gustav
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now