Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Save active sheet as "filename" on a remote server with username and password

Hi gurus

(I know many of you are :-)

How do I sav a file on a network server I am not mapped up to?
I must provide a username and password.
How do I set in username and password for the server into the code???

v_FULLPATH_FILE_NAME =\\servername\driveletter$\folder\subfolder
\filename"

Application.ScreenUpdating = False
Inst.Copy ' name of the sheet
With ActiveSheet.Parent
Application.DisplayAlerts = False
.SaveAs Filename:=v_FULLPATH_FILE_NAME, FileFormat:=xlText
.Close SaveChanges:=False
Application.DisplayAlerts = True
MsgBox "Data saved"
End With
Application.ScreenUpdating = True

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Save active sheet as "filename" on a remote server with username a

Teddy,

I think you will have to map to the network location. Here's an example
that will map the network location to drive Z and then unMap it at the end...

Sub trythis()

Dim strNetworkPath As String
Dim objNet As Object


strNetworkPath = "\\servername\driveletter$\folder\subfolder"

Set objNet = CreateObject("Wscript.Network")
objNet.MapNetworkDrive "Z:", strNetworkPath, False, "domain\username",
"password"

Application.ScreenUpdating = False
Inst.Copy ' name of the sheet
With ActiveSheet.Parent
Application.DisplayAlerts = False
.SaveAs Filename:=strNetworkPath & "\sample.xls", FileFormat:=xlText
.Close SaveChanges:=False
Application.DisplayAlerts = True
MsgBox "Data saved"
End With
Application.ScreenUpdating = True

objNet.RemoveNetworkdrive "Z:"
Set objNet = Nothing

End Sub


--
Hope that helps.

Vergel Adriano


"Teddy" wrote:

Hi gurus

(I know many of you are :-)

How do I sav a file on a network server I am not mapped up to?
I must provide a username and password.
How do I set in username and password for the server into the code???

v_FULLPATH_FILE_NAME =\\servername\driveletter$\folder\subfolder
\filename"

Application.ScreenUpdating = False
Inst.Copy ' name of the sheet
With ActiveSheet.Parent
Application.DisplayAlerts = False
.SaveAs Filename:=v_FULLPATH_FILE_NAME, FileFormat:=xlText
.Close SaveChanges:=False
Application.DisplayAlerts = True
MsgBox "Data saved"
End With
Application.ScreenUpdating = True


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Save active sheet as "filename" on a remote server with username a

"Teddy" wrote:

Hi gurus

(I know many of you are :-)

How do I sav a file on a network server I am not mapped up to?
I must provide a username and password.
How do I set in username and password for the server into the code???

v_FULLPATH_FILE_NAME =\\servername\driveletter$\folder\subfolder
\filename"

Application.ScreenUpdating = False
Inst.Copy ' name of the sheet
With ActiveSheet.Parent
Application.DisplayAlerts = False
.SaveAs Filename:=v_FULLPATH_FILE_NAME, FileFormat:=xlText
.Close SaveChanges:=False
Application.DisplayAlerts = True
MsgBox "Data saved"
End With
Application.ScreenUpdating = True



Hi Teddy,

It is not a good idea to store your passwords
in a text file.

I think the usual way to do what you want is
to share the folder where your files will be
saved, create a group, grant that group read/write
permissions on that folder, and add all the
users that will be saving Excel files to the group.
The details will depend on your network settings
(Workgroup or AD etc.)

You should probably contact your admin for that.

Hope this helps some.

--
urkec
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
a Macro to "save as" filename from a cell on the sheet and then pr gugertmk Excel Discussion (Misc queries) 0 March 31st 09 12:32 AM
"filename is locked for editing by username" srinath Excel Discussion (Misc queries) 1 February 26th 09 11:35 AM
"CELL("FILENAME") NOT UPDATE AFTER "SAVE AS" ACTION yossie6 Excel Discussion (Misc queries) 1 June 16th 08 12:16 PM
is it possible to disable "save" prompt in excel file on web server? [email protected] Excel Discussion (Misc queries) 0 May 9th 07 05:58 PM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM


All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"