exporting as csv a renamed Numbers file to Dropbox

I am trying to export to dropbox as a csv file a numbers file which will be automatically renamed for export while still retaining the original file as originally named.
I can create a name for the export file but am lost beyond that point (see below)

[code]activate application “Numbers”

tell application “Numbers”
set dName to name of first window
if dName ends with “.numbers” then
set csvName to (text 1 thru -9 of dName) & “.csv”
else
set csvName to dName & “.csv”
end if
end tell[/code]
Thank you in advance for any help

You may try

set p2d to path to desktop as text

activate application "Numbers"

tell application "Numbers"
	set dName to name of first window
	if dName ends with ".numbers" then
		set csvName to (text 1 thru -9 of dName) & ".csv"
	else
		set csvName to dName & ".csv"
	end if
	export document 1 to file (p2d & csvName) as CSV
end tell

which export in a CSV file on the Desktop.
Edit the first instruction to fit your needs.

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) jeudi 26 novembre 2015 18:21:00

When I attempt to replace “desktop” in the script with a folder location say “MyHD:Users:me:Dropbox:” or in my case shown below, I get the error
‘Can’t make “BOB_R:Users:bobrutledge:Dropbox:” into type constant.’
I can’t figure out where I have gone astray.
I’m trying to avoid the extra step of having to move a file from by Desktop to my Dropbox.

What are you exactly trying to execute?

I’m afraid that you use :
set p2d to path to “BOB_R:Users:bobrutledge:Dropbox:” as text
which returns exactly what you wrote.

Try with the correct syntax :

set p2d to (path to home folder as text) & “Dropbox:”

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) samedi 28 novembre 2015 10:39:26

Thank you very much. With a few tweaks, this is now doing what I had envisioned - sweet.
I’m usually pretty quick to grasp things but this is coming slowly - so many little subtleties.
I learn best by example and yours have been helpful.