henter data i Ark1 og bruger det til fil navnet
Hvordan får jeg den til at henter data i Ark1 og bruger det til fil navnet min makro ser sådan udSub Gem_som()
'
' Gem_som Makro
' Makro indspillet 07-01-2007 af Jørgen Elbæk Haahr
'
Dim strSaveAsName As String
Dim strMsg As String
Dim strDialogs As Dialogs
Dim Number As String
'
' Replace the following document name "MyDoc.Doc" with
' the name you want to use to "Save As."
'strSaveAsName = "SMHFaktura_" + Format(Now, "dd-mm-yyyy") + "_" + Sheets("Faktura").Range(D12)
strSaveAsName = "SMH-Faktura" + "_" + Sheets("Faktura").Range("D12")
' Message to return if file exists.
strMsg = "Do you want to replace the existing " & strSaveAsName & "?"
' Check if the file exists.
If Dir(strSaveAsName & "*") = "C:\Documents and Settings\Morpheus\Application Data\Microsoft\Skabeloner\" Then
' If file does not exist, save without prompting.
ActiveWorkbook.SaveAs Filename:=strSaveAsName
Else
' If file does exist, prompt with warning message.
' Check value of button clicked in message box.
Select Case MsgBox(strMsg, vbYesNoCancel + vbExclamation)
Case vbYes
' If Yes was chosen, save and overwrite existing file.
ActiveWorkbook.SaveAs Filename:=strSaveAsName & "_1"
Case vbNo
' If No was chosen, prompt for file name
' using the File SaveAs dialog box.
'With strDialogs(XlDialogSaveAs)
' End With
Application.Dialogs(XlDialogSaveAs).Show (strSaveAsName)
Case Else
' If Cancel was chosen, do nothing.
End Select
End If
End Sub