ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro in excel to save to an unmapped drive ! (https://www.excelbanter.com/excel-discussion-misc-queries/65800-macro-excel-save-unmapped-drive.html)

[email protected]

Macro in excel to save to an unmapped drive !
 
Help...
Can anybody hlep me out here... I am trying to construct a macro part
of which will save a file to an unmapped drive, i can do this when the
filename is static but I need to change the filename
cellvalue2 = Sheets("explanations").Range("F1").Text
myvalue = cellvalue2
ActiveWorkbook.SaveAs Filename:=myvalue


I can also do it when I have a mapped drive by using CHDRIV "E:"

but not to an unmapped one !


Can anybody help?


Dave Peterson

Macro in excel to save to an unmapped drive !
 
Maybe....

dim myPath as string
dim CellValue2 as string

'point at the UNC path here.
myPath = "\\server\folder\folder\"
if right(mypath,1) < "\" then
mypath = mypath & "\"
end if

cellvalue2 = Sheets("explanations").Range("F1").Text
ActiveWorkbook.SaveAs Filename:=mypath & cellvalue2

wrote:

Help...
Can anybody hlep me out here... I am trying to construct a macro part
of which will save a file to an unmapped drive, i can do this when the
filename is static but I need to change the filename
cellvalue2 = Sheets("explanations").Range("F1").Text
myvalue = cellvalue2
ActiveWorkbook.SaveAs Filename:=myvalue

I can also do it when I have a mapped drive by using CHDRIV "E:"

but not to an unmapped one !

Can anybody help?


--

Dave Peterson

[email protected]

Macro in excel to save to an unmapped drive !
 
Dave...
Works like a dream...
Many Thanks

Robin



All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com