Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1128to1132
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Mit einem Makro als html Seite hochladen | Herbers Excel-Forum

Mit einem Makro als html Seite hochladen
20.01.2010 19:28:46
Sankt

Hallo,
gibt es die Möglichkeit eine Exceldatei mit einem Makro als HTML Seite hochzuladen??
Gruß
Sankt

15
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Mit einem Makro als html Seite hochladen
20.01.2010 19:34:48
Hajo_Zi
Hallo Sankt,
die Datei oder eine Tabelle? Um was geht es Dir nur die Darstellung?

AW: Mit einem Makro als html Seite hochladen
20.01.2010 19:46:13
Sankt
Hallo Hajo,
es geht um Ergebnisse. die werden sortiert in einer Tabelle dagestellt.
Es soll die Tabelle dann als Live Tabelle in Netz zusehen sein.
Gruß
Sankt
AW: Mit einem Makro als html Seite hochladen
20.01.2010 19:54:34
Sankt
Hallo Hajo,
diese Datei

Die Datei https://www.herber.de/bbs/user/67361.xls wurde aus Datenschutzgründen gelöscht


würde ich gerne hochladen so das ich sie als html ausgeben kann
Gruß
Sankt
AW: Mit einem Makro als html Seite hochladen
20.01.2010 19:57:50
Hajo_Zi
Hallo Sankt,
warum nicht einfach speichern als HTML?
Gruß Hajo
Anzeige
AW: Mit einem Makro als html Seite hochladen
20.01.2010 20:22:39
Sankt
Hallo Hajo,
ok. aber gibt es denn auch die Möglichkeit diese dann mit einem Makro auf den server zu laden??
Gruß
Sankt
AW: Mit einem Makro als html Seite hochladen
20.01.2010 23:00:49
Josef Ehrensberger
Hallo Heiliger,
ungetestet! Im Code bitte unter "Einstellungen" deine Daten eintragen.
Und beachte bitte, das die Übertragung unverschlüsselt erfolgt, Benutzername und Passwort
liegen also im Klartext vor!
https://www.herber.de/bbs/user/67366.xls
Gruß Sepp
AW: Mit einem Makro als html Seite hochladen
21.01.2010 01:07:51
Sankt
Hallo Jupp,
'------------- Einstellungen START -----------------------
Const cstrFTPServer = "http://www.abc.de" 'ftp-Server
Const cstrUser = "amigo" 'Benutzername
Const cstrPassword = "oma" 'Passwort
Const cstrPath = "/" 'ftp-Zielverzeichnis
'------------- Einstellungen ENDE -----------------------
habe ich das so richtig eingetragen.
Es kommt der Fehler Error:File not found
Gruß
Sankt
Anzeige
AW: Mit einem Makro als html Seite hochladen
21.01.2010 01:21:49
Josef Ehrensberger
Hallo Sankt,
als Serveradresse hätte ich eher "ftp://..." erwartet und bei cstrPath sollte es wohl "\" statt "/" heißen.
Gruß Sepp
AW: Mit einem Makro als html Seite hochladen
21.01.2010 09:19:40
Sankt
Hallo Sepp,
'------------- Einstellungen START -----------------------
Const cstrFTPServer = "ftp://www.abc.de" 'ftp-Server
Const cstrUser = "ftpamigo" 'Benutzername
Const cstrPassword = "oma" 'Passwort
Const cstrPath = "\" 'ftp-Zielverzeichnis
'------------- Einstellungen ENDE -----------------------
Es kommt immer noch Error:File not found
Laufzeitfehler 53
Datei nichtgefunden
Gruß
Sankt
Anzeige
AW: Mit einem Makro als html Seite hochladen
21.01.2010 09:24:37
Josef Ehrensberger
Hallo Sankt,
kannst du mit diesen Daten mit deinem FTP-Programm auf den Server zugreifen?
Hast du die entsprechenden Rechte um Daten hochzuladen?
Ich glaube, ehrlich gesagt nicht, das der Server unter "ftp://www...." zu erreichen ist, ftp addressen
enthalten, im Regelfall, kein www.
Gruß Sepp
AW: Mit einem Makro als html Seite hochladen
21.01.2010 10:00:34
Sankt
Hallo Sepp,
ich kann mit mit einem FTP Programm die Daten hochladen.
Protokoll; FTP Standard
Server: www.abc.de
StarDir FTP : /
Kennwort: ftpamigo
Kennwort: oma
ich kann komplett auf die Interseite zugreifen
Gruß
Sankt
AW: Mit einem Makro als html Seite hochladen
21.01.2010 10:44:28
Josef Ehrensberger
Hallo Sankt,
sorry, habe im Moment keine andere Idee.
Gruß Sepp
Anzeige
Mit Makro als html Seite hochladen
21.01.2010 14:43:50
Anton
Hallo zusammen,
so vllt(ungetestet):
Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)      
Sub PutFTPFile()
  Dim strReturn As String  
  Dim strUploadFile, strSheetName As String  
  Dim strRange As String, strTitle As String    
 
 '------------- Einstellungen    START -----------------------
  Const cstrFTPServer = "ftpsite.com"      'ftp-Server
  Const cstrUser = "myUserName"            'Benutzername
  Const cstrPassword = "myPassword"        'Passwort
  Const cstrPath = "subfolder"             'ftp-Zielverzeichnis
 '------------- Einstellungen     ENDE -----------------------
 
  strSheetName = "Tabelle1"
 
  strRange = ThisWorkbook.Sheets(strSheetName).UsedRange.Address
 
  strTitle = "" 'ThisWorkbook.Sheets(strSheetName).Range("A1").Text
 
  strUploadFile = Environ("USERPROFILE") & "\tmp.html"
 
  With ThisWorkbook.PublishObjects.Add( _  
      SourceType:=xlSourceRange, _
      Filename:=strUploadFile, _
      Sheet:=strSheetName, _
      Source:=strRange, _
      HtmlType:=xlHtmlStatic, _
      Title:=strTitle)
    .Publish (True)
  End With  
 
  strReturn = FTPUpload(cstrFTPServer, cstrUser, cstrPassword, strUploadFile, cstrPath)
 
  MsgBox strReturn
 
  Kill Replace(strUploadFile, Chr(34), "")
End Sub  
Private Function FTPUpload(sSite, sUsername, sPassword, sLocalFile, sRemotePath) As String    
  Dim oFTPScriptFSO As Object, oFTPScriptShell As Object  
  Dim sFTPScript As String, sFTPTemp As String, sFTPTempFile As String  
  Dim sFTPResults As String, sResults As String  
  Dim fFTPScript As Variant, fFTPResults As Variant  
 
 'This script is provided under the Creative Commons license located
 'at http://creativecommons.org/licenses/by-nc/2.5/ . It may not
 'be used for commercial purposes with out the expressed written consent
 'of NateRice.com
 
  Const OpenAsDefault = -2  
  Const FailIfNotExist = 0  
  Const ForReading = 1  
  Const ForWriting = 2  
 
  Set oFTPScriptFSO = CreateObject("Scripting.FileSystemObject")  
  Set oFTPScriptShell = CreateObject("WScript.Shell")  
 
  sRemotePath = Trim(sRemotePath)
  sLocalFile = Trim(sLocalFile)
 
 '----------Path Checks---------
 'Here we willcheck the path, if it contains
 'spaces then we need to add quotes to ensure
 'it parses correctly.
  If InStr(sRemotePath, " ") > 0 Then  
    If Left(sRemotePath, 1) <> """" And Right(sRemotePath, 1) <> """" Then  
      sRemotePath = """" & sRemotePath & """"
    End If  
  End If  
 
 'Check the local path and file to ensure
 'that either the a file that exists was
 'passed or a wildcard was passed.
  If InStr(sLocalFile, "*") Then  
    If InStr(sLocalFile, " ") Then  
      FTPUpload = "Error: Wildcard uploads do not work if the path contains a " & _
        "space." & vbCrLf
      FTPUpload = FTPUpload & "This is a limitation of the Microsoft FTP client."
      Exit Function  
    End If  
  ElseIf Len(sLocalFile) = 0 Or Not oFTPScriptFSO.FileExists(sLocalFile) Then      
   'nothing to upload
    FTPUpload = "Error: File Not Found."  
    Exit Function  
  End If  
 
  If InStr(sLocalFile, " ") > 0 Then  
    If Left(sLocalFile, 1) <> """" And Right(sLocalFile, 1) <> """" Then  
      sLocalFile = """" & sLocalFile & """"
    End If  
  End If  
 
 'Check to ensure that a remote path was
 'passed. If it's blank then pass a "\"
  If Len(sRemotePath) = 0 Then  
   'Please note that no premptive checking of the
   'remote path is done. If it does not exist for some
   'reason. Unexpected results may occur.
    sRemotePath = "\"
  End If  
 
 '--------END Path Checks---------
 
 'build input file for ftp command
  sFTPScript = sFTPScript & "USER " & sUsername & vbCrLf
  sFTPScript = sFTPScript & sPassword & vbCrLf
  sFTPScript = sFTPScript & "cd " & sRemotePath & vbCrLf
  sFTPScript = sFTPScript & "binary" & vbCrLf
  sFTPScript = sFTPScript & "prompt n" & vbCrLf
  sFTPScript = sFTPScript & "put " & sLocalFile & vbCrLf
  sFTPScript = sFTPScript & "quit" & vbCrLf & "quit" & vbCrLf & "quit" & vbCrLf
 
  sFTPTemp = oFTPScriptShell.ExpandEnvironmentStrings("%TEMP%")
  sFTPTempFile = sFTPTemp & "\" & oFTPScriptFSO.GetTempName
  sFTPResults = sFTPTemp & "\" & oFTPScriptFSO.GetTempName
 
 'Write the input file for the ftp command
 'to a temporary file.
  Set fFTPScript = oFTPScriptFSO.CreateTextFile(sFTPTempFile, True)  
  fFTPScript.WriteLine (sFTPScript)
  fFTPScript.Close
  Set fFTPScript = Nothing  
 
  oFTPScriptShell.Run "%comspec% /c FTP -n -s:" & sFTPTempFile & " " & sSite & _
    " > " & sFTPResults, 0, True
 
  Sleep 1000
 
 'Check results of transfer.
  Set fFTPResults = oFTPScriptFSO.OpenTextFile(sFTPResults, ForReading, _    
    FailIfNotExist, OpenAsDefault)    
  sResults = fFTPResults.ReadAll
  fFTPResults.Close
 
  oFTPScriptFSO.DeleteFile (sFTPTempFile)
  oFTPScriptFSO.DeleteFile (sFTPResults)
 
  If InStr(sResults, "226 Transfer complete.") > 0 Then  
    FTPUpload = "Done"
  ElseIf InStr(sResults, "File not found") > 0 Then    
    FTPUpload = "Error: File Not Found"  
  ElseIf InStr(sResults, "cannot log in.") > 0 Then    
    FTPUpload = "Error: Login Failed."
  Else
    FTPUpload = "Error: Unknown."
  End If  
 
  Set oFTPScriptFSO = Nothing  
  Set oFTPScriptShell = Nothing  
End Function  


mfg Anton
Anzeige
AW: Mit Makro als html Seite hochladen
24.01.2010 21:38:02
Sankt
Hallo Anton,
erstmal vielen Dank für deine Antwort.
Es kommt nur noch die Fehlermeldung Unknown..
Ich habe es bei den Einstellung mit allen Varianten die Ich kenne versucht.
Weißt du viellleicht noch einen Rat??
Gruß
sankt
AW: Mit Makro als html Seite hochladen
25.01.2010 16:51:36
Anton
Hallo Sankt,
füge vor dem Ende der Funktion die Msgbox ein , dann siehst du die komplette Ausgabe des ftp-Befehls und findest vllt heraus , wo der Fehler liegt.
Code:
  MsgBox sResults
End Function  


mfg Anton
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige