Solved

Burn CD from MS Access

Posted on 2014-04-06
3
832 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

809 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