Fileformat not working

JamRivera

New Member
Joined
Jun 9, 2019
Messages
36
I'm extremely new to building macros so here is my situation.
We have users opening a macro enabled excel file on our intranet.
I'm trying to keep users from saving the file back to the intranet once opened. I want the user to save the file to their drive once opened. Once a user opens the file from the intranet the macro automatically opens the save as file (to a specific path). the user types in a file name. The problem is the file is saved as a file with no filetype asscoiated to the file. I'm using FileFormat:=52 but maybe I didn't place it in the correct place inmy code or I'm just using ileformat the wrong way.

Please advise anything would be helpful at this point.

Using excel 2010

here is the macro

Sub Auto_Open()
MsgBox "Save to desktop prior to working", vbInformation + vbOKOnly, "Hello Ops Team"

Dim workbook_Name As Variant
workbook_Name = Application.GetSaveAsFilename("R:\Provider Ops\Triaging for Vendors")
If workbook_Name <> False Then

ActiveWorkbook.SaveAs _
Filename:=workbook_Name, _
FileFormat:=52 (Save as Type - shows up as "All Files")


End If

End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi & welcome to MrExcel.
How about
ActiveWorkbook.SaveAs _
FileName:=workbook_Name & ".xlsm", _
FileFormat:=52
 
Upvote 0
This works just great!!! Thank you so much but now it saves the file at "Libraries\Documents" instead of the path I have listed in the code r:\Provider Ops\Triaging for Vendors"
 
Upvote 0
That code should save the file to whereever is selected in the DialogueBox.
Is "R:\Provider Ops" a valid path?
 
Upvote 0
Hi Fluff again thank you so much this works great and yes the path exists. when my users open the file from the intranet it opens the save as window and the path is prepopulated. the path is to a folder on our network where each user has their own folder to save the file they opened from the intranet. here is te updated macro

Sub Auto_Open()
MsgBox "Save to desktop prior to working", vbInformation + vbOKOnly, "Hello Ops Team"
Dim workbook_Name As Variant
workbook_Name = Application.GetSaveAsFilename("R:\Provider Ops\Triaging for Vendors")
If workbook_Name <> False Then
ActiveWorkbook.SaveAs _
FileName:=workbook_Name & ".xlsm", _
FileFormat:=52


End If

End Sub

Everything is the same with the exception of fileformat please advise what I need to d next Thank you
 
Upvote 0
When the dialogue box opens does it show you in R:\Provider Ops folder?
 
Upvote 0
That suggests that you don't have a folder on the R drive called "Provider Ops"
 
Upvote 0
You were absolutely correct. My Network disconnected from the R drive. Once I reconnected the macro worked like a charm.
Now all I need is to figure out
1-code to check the path is valid
2-code to stop the macro once the user has saved the file in their folder so user is not prompt to resave when they open the file from their folder
Thank you so much you have been a great help. BTW any further advise would be deeply appreciated.
 
Upvote 0
How about
Code:
Sub Auto_Open()
Dim Workbook_Name As Variant

MsgBox "Save to desktop prior to working", vbInformation + vbOKOnly, "Hello Ops Team"

If Dir("R:\Provider Ops", vbDirectory) = "" Then
   MsgBox "No folder"
   Exit Sub
End If
If ThisWorkbook.name = "Triaging for Vendors.xlsm" Then Exit Sub
Workbook_Name = Application.GetSaveAsFilename("R:Provider Ops\Triaging for Vendors")
If Workbook_Name <> False Then

   ActiveWorkbook.SaveAs _
      FileName:=Workbook_Name & ".xlsm", _
      FileFormat:=52

End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,959
Messages
6,175,647
Members
452,663
Latest member
MEMEH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top